Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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....


  #2   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do i write an offset code ? Corey Excel Programming 12 January 4th 07 12:18 AM
ActiveCell.Offset Code workerboy[_2_] Excel Programming 2 August 10th 06 02:23 PM
Code to write out all lines of code davidm Excel Programming 3 August 5th 05 04:26 AM
Using VBA to Write VBA code SB Excel Programming 10 January 23rd 04 02:01 PM
Offset Code Todd Huttenstine[_2_] Excel Programming 7 December 5th 03 03:47 AM


All times are GMT +1. The time now is 09:36 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"