View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Corey Corey is offline
external usenet poster
 
Posts: 363
Default How do i write an offset code ?

JMB,

This is what i have now, but to date i still get no other value in the sheet
Previewed except for the Combobox1.value in cell("O4") ???

Did i miss something you advised here?



Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
With ActiveWorkbook.workSheets("Inspections")
..Select
Range("O4").Value = ComboBox1.Value ' This works Great
UserForm3.Hide

Dim rngFound As Range
On Error Resume Next
With workSheets("InspectionData").Range("A:A")
Set rngFound = .Find(what:=Me.ComboBox1.Value, after:=.Range("A1"),
LookIn:=xlValues, lookat:=xlWhole, searchorder:=xlByRows,
searchdirection:=xlNext, MatchCase:=False, matchbyte:=False)
End With
On Error GoTo 0
If Not rngFound Is Nothing Then
workSheets("Inspections").Range("E2").Value = rngFound.Offset(-1, 2).Value
' <========== There is a value in "InspectionData".Range"C1" BUT this does
not display in the Sheet"Inspections".Range"E2" ???
End If
ActiveWindow.SelectedSheets.PrintPreview ' Preview worksheet to either
Print of simply View
Range("O4,E2").ClearContents ' Clears all data that was brought in from
sheet "InspectionData"
Sheets("Main").Select ' Takes the user back to the Main Page
Range("A1").Select
Application.ScreenUpdating = True
End With
Unload Me
End Sub


Corey....