Home |
Search |
Today's Posts |
#1
|
|||
|
|||
MsgBox compile error in Excell
From Microsoft training on Loops. copied the following Do While Loop:
Sheets("Sheet1 (2)").Select x = ActiveCell.Row y = ActiveCell.Column z = 0 Do While Cells(x, y).Value < "" x = x + 1 z = z + 1 Loop MsgBox "There are "&z&" cells in the current range." End Sub Microsoft Visual Basic MsgBox in red and stated, "Expected:end of statement" Someone wrote Close. Where and how to you type it into the MsgBox? New beginner please be more specific. |
#2
|
|||
|
|||
Jerry,
You need spaces before and after the & characters. Without them, VBA is attempting to use them as data type specifiers. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Jerry Dyben" wrote in message ... From Microsoft training on Loops. copied the following Do While Loop: Sheets("Sheet1 (2)").Select x = ActiveCell.Row y = ActiveCell.Column z = 0 Do While Cells(x, y).Value < "" x = x + 1 z = z + 1 Loop MsgBox "There are "&z&" cells in the current range." End Sub Microsoft Visual Basic MsgBox in red and stated, "Expected:end of statement" Someone wrote Close. Where and how to you type it into the MsgBox? New beginner please be more specific. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Can I view an excell document without excell (not installed wit. | Excel Discussion (Misc queries) | |||
Compile error for MsgBox copied from Microsoft training example? | Excel Discussion (Misc queries) | |||
insert query into excell sheet to update excell sheet and pivot table | Excel Discussion (Misc queries) | |||
Msgbox | Excel Worksheet Functions | |||
lable ranges in Excell | Excel Discussion (Misc queries) |