End(xlDown) syntax

SGBCleve

New Member
Joined
Dec 4, 2011
Messages
35
I am using Excel 2010 and having trouble with using a Range.End(xlDown) statement not being recognized.

I have tried Range("B4, Range("B4").End (xldown)).Count
Range(Range("B4"), Range("B4").End(xlDown)).Count
and a variety of other attempts.
Obviously, the first value in the Range is Range("B4") and the second value is Range ("B4").End(xlDown)
Do I need another quotation mark before the .Count statement?

This is driving me crazy. Thank you:eek:
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Not sure what you are trying to do but if you are looking for a count of cells from B4 down you could use something like this.
Code:
Dim cnt As Long

    cnt = Range("B4", Range("B4").End(xlDown)).Count

    MsgBox cnt & " cells in column B."
 
Upvote 0
Your 2nd was fine though not typically done that way.
Code:
Sub Test()
  MsgBox Range("B4", Range("B4").End(xlDown)).Count
  MsgBox Range(Range("B4"), Range("B4").End(xlDown)).Count
  MsgBox Range([B4], [B4].End(xlDown)).Count
  MsgBox Range("B4", Cells(Rows.Count, "B").End(xlUp)).Count
End Sub
 
Upvote 0
Yes, that is what I am looking for, but for some reason it gives me needs separator at the second cell address.
I have it written as
Counter = Sheets(i).Range("K2, Range("K2").End(xlDown)).Count and it won't compile. It says needs list separator or parenthesis.
 
Upvote 0
All the Test Subroutines work. Not sure why it wouldn't compile in my code and got stuck with Range("K2"). Will try again and make sure all other windows are closed, but I did specify the worksheet.
 
Upvote 0
In this code it should be "B4" not just "B4.
Rich (BB code):
Range("B4, Range("B4").End (xldown)).Count
 
Upvote 0
I tried it with quotes before, too. But that must have been the error. I am on to the next error now :p
Thank you.
 
Upvote 0

Forum statistics

Threads
1,216,088
Messages
6,128,744
Members
449,466
Latest member
Peter Juhnke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top