![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: May 2002
Posts: 18
|
What does the 'With' statement do?
Also, what is wrong with the code below? Private Sub Inputdata_Click() Worksheets("Input").Activate Cells(5, 3).Select If (ActiveCell.Value = "") Then Exit Sub Worksheets("Sheet2").Activate Cells(5, 4).Select ActiveCell.Value = 1 End Sub I get an error that says 'Select method of Range Class fails' and I dont know why. I am new to Visual Basic and I would appreciate anyone's help. Thanks Seri |
|
|
|
|
|
#2 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
|
From the help file on the "with statement"
Quote:
|
|
|
|
|
|
|
#3 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
|
You are getting a Runtime error 1004, The error is for the following reason:
Quote:
Private Sub Inputdata_Click() If Worksheets("Input").Cells(5, 3).Value = "" Then Exit Sub Worksheets("Sheet2").Cells(5, 4).Value = 1 End Sub or Private Sub Inputdata_Click() If Worksheets("Input").Cells(5, 3).Value <> "" Then _ Worksheets("Sheet2").Cells(5, 4).Value = 1 End Sub _________________ Hope this helps. Kind regards, Al. [ This Message was edited by: Al Chara on 2002-05-23 13:15 ] |
|
|
|
|
|
|
#4 |
|
New Member
Join Date: May 2002
Posts: 18
|
That cleared it all up. Thank you. I love this site.
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|