Hi All,![]()
Userforms
Userform1 = Data that inputs into InspectionData Sheet
Userform3 = Prompt to Ask for a Certain Value in InspectionData.Column A
Sheets
InspectionData = values from a userform are stored here.
Inspections = Sheet to be printed out(either BLANK or with Values pulled from InspectionData sheet)
Code to fill Combobox1 on userform3
Private Sub UserForm_Initialize()
Dim lastcell As Long
Dim myrow As Long
lastcell = workSheets("InspectionData").Cells(Rows.Count, "A").End(xlUp).Row
With ActiveWorkbook.workSheets("InspectionData")
.Select 'first thing to do with a With statement that occurs on a second sheet
For myrow = 2 To lastcell
If .Cells(myrow, 1) <> "" Then
If IsNumeric(Trim(Mid(.Cells(myrow, 1), 2))) = True Then 'this part excludes the # sign then checks for numeric
ComboBox1.AddItem Cells(myrow, 1)
End If
End If
Next
End With
End Sub
Code to Place data into another sheet
(When OK button is clicked on userform3)
Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
UserForm3.Hide
Unload Me
With ActiveWorkbook.workSheets("Inspections")
.Select
Range("O4").Value = ComboBox1.Value ' Value that was selected from Userform3.
ActiveWindow.SelectedSheets.PrintPreview
Range("O4").ClearContents
Sheets("Main").Select
Range("A1").Select
Application.ScreenUpdating = True
End With
End Sub
I need to be able to get many other values from the InspectionData sheet, BUTI need to reference these other values from the Value that was selected in the combobox.
EG. The value selected in the combobox could actually be:
sheets("InspectionData").Range("A125")
The next value i need to get is in cell:
sheets("InspectionData").Range("C124") IE. offset(2,-1) from the combobox cell.
I am not fluent enough in VBA to set this up.
Can someone please assist me to code the combobox value as a TARGET or ADDRESS, or the like, and then how i can code a cell.offset from there?
Regards
Corey....
Bookmarks