Select the first cell in row with frezze panes active

tigerdel

Board Regular
Joined
Oct 13, 2015
Messages
145
Office Version
  1. 365
Platform
  1. Windows
I have a sheet that has a Table (PeriodStatement) and has freeze pane active at I3
I have VBA to add a new row:
Code:
    Range("AR3").Select
    Selection.End(xlDown).Select
    Selection.ListObject.ListRows.Add AlwaysInsert:=False
    Cells(ActiveWindow.RangeSelection.Row, 1).Select
but I need it to select the first cell in the added row but if freeze panes is active it always selects the cell in Column I
Can it be done that it select the cell in Column A
Many thanks for looking
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
I can't reproduce your sheet exactly but does this code work?

VBA Code:
Dim Ws As Worksheet
Dim objTable As ListObject

    Set Ws = Worksheets("AddRowToTable")
        
    Set objTable = Ws.ListObjects("PeriodStatement")
    
    objTable.ListRows.Add AlwaysInsert:=False
        
    objTable.Range.Cells(1).Offset(objTable.Range.Rows.Count - 1).Select
    
    Set objTable = Nothing
 
Upvote 1

Forum statistics

Threads
1,223,904
Messages
6,175,295
Members
452,633
Latest member
DougMo

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