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

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
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,224,817
Messages
6,181,148
Members
453,021
Latest member
Justyna P

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