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

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
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,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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