Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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.... |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do i write an offset code ?
First, I would test the data to make sure they are the same. It appears the
combobox value is in O4 and the value you are trying to match it to is in A1, so in an empty cell somewhere, enter: =Inspections!O4=InspectionData!A1 If it's false, the two values are not the same. If that fails, is it possible to email the book to me? jeffblakley@ hotmail.com "Corey" wrote: 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.... |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do i write an offset code ? | Excel Programming | |||
ActiveCell.Offset Code | Excel Programming | |||
Code to write out all lines of code | Excel Programming | |||
Using VBA to Write VBA code | Excel Programming | |||
Offset Code | Excel Programming |