Syntax error. Trying to auto fill based on last row of data in another sheet

lhenry998

New Member
Joined
Nov 2, 2023
Messages
1
Platform
  1. Windows
Sub Rectangle2_Click()
Dim wsA As Worksheet
Dim wsB As Worksheet
Dim lRow As Long

'~~> Set these to relevant sheets
Set wsA = Sheet3
Set wsB = Sheet4

'~~> Find last row in Sheet A
lRow = wsA.Range("A" & wsA.Rows.Count).End(xlUp).Row

'~~> Update formulas in Sheet B till relevant rows
wsB.Range("B2:W" & lRow).Formula = wsB.Range("B2:W2").Formula

Range("A2").AutoFill Destination:=Range("A2:A" & 1Row)

End Sub


I am receiving a Compile error: Expected: List separator or ). Do you have any ideas?
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
I am receiving a Compile error: Expected: List separator or ). Do you have any ideas?
On which line (and 1Row on the last line should be lrow btw, which might correct your error)?

EDIT:
P.S. I would also specify the worksheet on the last line
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,111
Messages
6,123,155
Members
449,098
Latest member
Doanvanhieu

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