Rows.Count Problem

poorwallace

Active Member
Joined
Mar 8, 2005
Messages
365
Question....

I'm having a particular problem on what should be a routine issue. When I try to determine the last cell in a range, VB is recognizing the cell value... This seems strange to me, as I've used this before with no problem.

the problem is that the last cell in the range is populated with a 4. VB is taking that 4 and using it as LstC. Thus, instead of the 1 being input next to the last cell in the column, it is being input next to Cells(4, 4).

Here is the code

Code:
Dim LstC As Long
LstC = Cells(Rows.Count, 4).End(xlUp).Rows

Cells(LstC, 4).Offset(0, 1).Value = 1

Any suggestions?
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Change Rows to Row

LstC = Cells(Rows.Count, 4).End(xlUp).Row
 
Upvote 0
Guys, that was it! It always seems to be something simple. It's amazing I can still do stuff with gaps like that in my basic knowledge :oops:

Oh well. Thanks a bunch!
 
Upvote 0

Forum statistics

Threads
1,214,627
Messages
6,120,610
Members
448,973
Latest member
ChristineC

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