Macro For...Next Loop - use counter in FormulaR1C1

SkyWalker1012

New Member
Joined
Apr 10, 2022
Messages
2
Office Version
  1. 365
Platform
  1. Windows
I am trying load Picking Sheets with data from another sheet. I cannot workout the syntax to access the data. Receiving Compile error - Syntax.

how do I access the other sheet?

Sub Macro4()
'
' Macro4 Macro
'

'
Dim OrderCount As Integer

For OrderCount = 0 To 600
ActiveCell.Offset(0, 1).Range("A1:A2").Select
ActiveCell.FormulaR1C1 = "='pie drive numbers'!RC[-"&OrderCount*2&"]"
ActiveCell.Offset(2, 0).Range("A1").Select
ActiveCell.FormulaR1C1 = "='pie drive numbers'!RC[-"OrderCount*2"]"
ActiveCell.Select
Selection.AutoFill Destination:=ActiveCell.Range("A1:A23"), Type:= _
xlFillDefault
ActiveCell.Range("A1:A23").Select
ActiveCell.Offset(-2, 2).Range("A1").Select

Next OrderCount
End Sub
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
OOps ... I see the issue is that I didn't have a spaces around the &. It's working now
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,215
Members
452,618
Latest member
Tam84

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