Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Jerry Dyben
 
Posts: n/a
Default 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   Report Post  
Chip Pearson
 
Posts: n/a
Default

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
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
Can I view an excell document without excell (not installed wit. Gordon Excel Discussion (Misc queries) 8 May 2nd 06 05:41 AM
Compile error for MsgBox copied from Microsoft training example? Jerry Dyben Excel Discussion (Misc queries) 2 October 11th 05 05:48 AM
insert query into excell sheet to update excell sheet and pivot table vbsolo Excel Discussion (Misc queries) 0 August 24th 05 12:41 PM
Msgbox Wildman Excel Worksheet Functions 1 April 26th 05 04:57 AM
lable ranges in Excell david Excel Discussion (Misc queries) 2 February 2nd 05 11:26 PM


All times are GMT +1. The time now is 07:39 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"