Fill in formula based on last row and column

vilkas

New Member
Joined
Oct 12, 2013
Messages
14
Hi,

I am looking for macro that fills in the table range based on last column and row in row 1 and column A.

I am using the code to fill the formula based on last row however have no idea how to expand this to the left in order to fill in the column range (till the last column) for the same formula:

With Worksheets("PROVISIONS_TABLE NEW")
Lastrow = .Cells(Rows.Count, "A").End(xlUp).Row
.Range("B2").AutoFill Destination:=.Range("B2:B" & Lastrow
End With
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Hi

Try this:

Code:
Application.Calculation = xlCalculationManual
    With Worksheets("PROVISIONS_TABLE NEW")
     
      Lastrow = .Cells(Rows.Count, "A").End(xlUp).Row
      Lastcol = .Cells(Lastrow, Columns.Count).End(xlToLeft).Column
     
      .Range("B2").Copy Destination:=.Range("B2", Cells(Lastrow, Lastcol))
      
    End With
Application.Calculation = xlCalculationAutomatic
 
Upvote 0

Forum statistics

Threads
1,215,051
Messages
6,122,871
Members
449,097
Latest member
dbomb1414

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