How to calculate the row column in vba if there is 2 table in one sheet

holycome99

New Member
Joined
Nov 16, 2020
Messages
15
Office Version
  1. 365
Platform
  1. Windows
I have 2 table in a sheet now
I could calculate the row number of the first table easily as it is in the first column of my sheet so i can use

nextrec = Sheets("Chart Calculation").Cells(Rows.Count, 1).End(xlUp).Row + 1

But how about the another table?
The row number for the two table are not the same.
Thank you.
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
If you are actually talking about a Table you need to use the Table Name
Here is a example:
VBA Code:
Sub Count_Me()
'Modified 12/5/2020  12:40:49 AM  EST
Dim nextrec As Long
nextrec = Sheets(1).ListObjects("Table1").Range.Columns(1).Rows.Count
MsgBox nextrec
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,974
Messages
6,122,536
Members
449,088
Latest member
RandomExceller01

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