Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 363
Default Value NOT being input

The below code places valuies from the Sheet-"Data" into the Sheet-"Job card",
BUT, the Highlighted LINE value DOES NOT apear, WHY ??
Removing the 'On Error Resume Next' i get a Object Variable not set error.


Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
UserForm2.Hide
With ActiveWorkbook.Worksheets("Job Card")
..Select
Dim rngFound As Range
' On Error Resume Next
With Worksheets("Data").Range("A:A")
Set rngFound = .Find(What:=UserForm2.ListBox1.Value, After:=.Range("A1"), LookIn:=xlValues,
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, Matchbyte:=False)
Range("B2").Value = ListBox1.Value
Range("B6").Value = rngFound.Offset(0, 4).Value ' <===== Error here !!!
End With
' Preview worksheet to either Print of simply View
ActiveWindow.SelectedSheets.PrintPreview
' Clears all data that was brought in from sheet "InspectionData"
Dim c As Range
For Each c In Sheets("Job Card").UsedRange
If c.Locked = False Then
c.ClearContents
End If
Next
Sheets("NavigationPage").Activate
On Error GoTo 0
End With
Unload Me
Application.ScreenUpdating = True
End Sub

Help ??

Corey....


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 363
Default Value NOT being input

Never mind sussed it out.
Had a Custom value infront of the Numerical value, therefore the xlWhole did not find it.

"Corey" wrote in message ...
The below code places valuies from the Sheet-"Data" into the Sheet-"Job card",
BUT, the Highlighted LINE value DOES NOT apear, WHY ??
Removing the 'On Error Resume Next' i get a Object Variable not set error.


Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
UserForm2.Hide
With ActiveWorkbook.Worksheets("Job Card")
..Select
Dim rngFound As Range
' On Error Resume Next
With Worksheets("Data").Range("A:A")
Set rngFound = .Find(What:=UserForm2.ListBox1.Value, After:=.Range("A1"), LookIn:=xlValues,
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, Matchbyte:=False)
Range("B2").Value = ListBox1.Value
Range("B6").Value = rngFound.Offset(0, 4).Value ' <===== Error here !!!
End With
' Preview worksheet to either Print of simply View
ActiveWindow.SelectedSheets.PrintPreview
' Clears all data that was brought in from sheet "InspectionData"
Dim c As Range
For Each c In Sheets("Job Card").UsedRange
If c.Locked = False Then
c.ClearContents
End If
Next
Sheets("NavigationPage").Activate
On Error GoTo 0
End With
Unload Me
Application.ScreenUpdating = True
End Sub

Help ??

Corey....



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 363
Default Value NOT being input

Now it is NOT working ???
"Corey" wrote in message ...
The below code places valuies from the Sheet-"Data" into the Sheet-"Job card",
BUT, the Highlighted LINE value DOES NOT apear, WHY ??
Removing the 'On Error Resume Next' i get a Object Variable not set error.


Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
UserForm2.Hide
With ActiveWorkbook.Worksheets("Job Card")
..Select
Dim rngFound As Range
' On Error Resume Next
With Worksheets("Data").Range("A:A")
Set rngFound = .Find(What:=UserForm2.ListBox1.Value, After:=.Range("A1"), LookIn:=xlValues,
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, Matchbyte:=False)
Range("B2").Value = ListBox1.Value
Range("B6").Value = rngFound.Offset(0, 4).Value ' <===== Error here !!!
End With
' Preview worksheet to either Print of simply View
ActiveWindow.SelectedSheets.PrintPreview
' Clears all data that was brought in from sheet "InspectionData"
Dim c As Range
For Each c In Sheets("Job Card").UsedRange
If c.Locked = False Then
c.ClearContents
End If
Next
Sheets("NavigationPage").Activate
On Error GoTo 0
End With
Unload Me
Application.ScreenUpdating = True
End Sub

Help ??

Corey....



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Value NOT being input

after you do the .find, you'll want to test to see if you actually found the
value

set rngfound = .find.....

if rngfound is nothing then
'what should happen, msgbox, exit sub, beep???
else
'do the real work
end if



Corey wrote:

Now it is NOT working ???
"Corey" wrote in message ...
The below code places valuies from the Sheet-"Data" into the Sheet-"Job card",
BUT, the Highlighted LINE value DOES NOT apear, WHY ??
Removing the 'On Error Resume Next' i get a Object Variable not set error.

Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
UserForm2.Hide
With ActiveWorkbook.Worksheets("Job Card")
.Select
Dim rngFound As Range
' On Error Resume Next
With Worksheets("Data").Range("A:A")
Set rngFound = .Find(What:=UserForm2.ListBox1.Value, After:=.Range("A1"), LookIn:=xlValues,
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, Matchbyte:=False)
Range("B2").Value = ListBox1.Value
Range("B6").Value = rngFound.Offset(0, 4).Value ' <===== Error here !!!
End With
' Preview worksheet to either Print of simply View
ActiveWindow.SelectedSheets.PrintPreview
' Clears all data that was brought in from sheet "InspectionData"
Dim c As Range
For Each c In Sheets("Job Card").UsedRange
If c.Locked = False Then
c.ClearContents
End If
Next
Sheets("NavigationPage").Activate
On Error GoTo 0
End With
Unload Me
Application.ScreenUpdating = True
End Sub

Help ??

Corey....


--

Dave Peterson
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 to input pictures automatically based on cell input? bsharp Excel Worksheet Functions 9 May 30th 09 07:16 AM
input in number form is being multiplied by 1000 when i input. jweinograd Excel Discussion (Misc queries) 4 April 16th 07 11:18 PM
Have user input converted to uppercase in same cell as input? Shannonn New Users to Excel 1 June 20th 06 03:19 AM
=SUMIF(Input!H2:H718,AZ19,Input!E2:E685)AND(IF ALex Excel Worksheet Functions 2 March 14th 05 09:19 PM
CODE to select range based on User Input or Value of Input Field Sandi Gauthier Excel Programming 4 December 8th 03 03:22 PM


All times are GMT +1. The time now is 10:05 AM.

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"