Help with For function and FormulaR1C1

CoolMacro

New Member
Joined
Sep 9, 2013
Messages
16
Now I have a sheets with a first date and a last date of a period.
In other sheet I need complete a series of dates by columns with their respective workdays on this period.

I'm trying with For function and then using the formula "=Workday(RC[-1], 1)" like this:

Code:
Sub Período()


    Application.ScreenUpdating = False
    
    Dim j As Long
    
    With Sheets("Período")
        .Select
        
        For j = 1 To Sheets("Início2").Range("C1").Value Step 1
            .Cells("B", j).FormulaR1C1 = "=workday(RC[-1], 1)"
        Next j
    End With
        
        Application.ScreenUpdating = True
        
End Sub

But appears a Error, whats I'm making wrong?
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
You are using the Cells property incorrectly.

The row should be specified first followed by the column.

E.g. .Cells(j, "B").FormulaR1C1 = "=workday(RC[-1], 1)"
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,917
Members
452,366
Latest member
TePunaBloke

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