Amending code to go to last row of a table

STEVENS3010

Board Regular
Joined
Feb 4, 2020
Messages
89
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi all,

I have used the macro recorder to apply a table to some information in a sheet. At present it is using a specific range; could anybody help me amend the code to go to the last row instead as the data will not be the same number of rows every time? The current code from the recorder is...

VBA Code:
    ActiveSheet.ListObjects.Add(xlSrcRange, Range("$A$6:$F$20"), , xlYes).Name = _
        "Table3"
    Range("Table3[#All]").Select
    ActiveSheet.ListObjects("Table3").TableStyle = "TableStyleLight19"
    Range("A7").Select
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.

Forum statistics

Threads
1,215,972
Messages
6,128,027
Members
449,414
Latest member
sameri

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