autofill across sheets?

merlin777

Well-known Member
Joined
Aug 29, 2009
Messages
1,397
Office Version
  1. 2007
I know that I can cut and paste into multiple sheets by selecting them all but is there a way to autofill across sheets so, for instance sheet 1 has monday in A1 and sheet 2 will have tuesday etc?

Are there any other little-known sneaky tricks to working with multiple sheets?
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Try this:
Code:
Sub Autofill()
Dim Days(1 To 7) As String
Dim i
Dim a
 'This can be changed if you want Sunday to be 1 instead of 7
 Days(1) = "Monday"
 Days(2) = "Tuesday"
 Days(3) = "Wednesday"
 Days(4) = "Thursday"
 Days(5) = "Friday"
 Days(6) = "Saturday"
 Days(7) = "Sunday"
'Will do as many times as you have sheets
a = Sheets.Count
For i = 1 To a
'This assumes your sheets are always named Sheet1 Sheet2 etc.
Worksheets("Sheet" & i).Cells(1, 1).Value = Days(i)
Next i
End Sub
 
Upvote 0
Use something like this:

Code:
[COLOR=#0000ff]Sub [/COLOR]Test()
[COLOR=#0000ff]For Each [/COLOR]ws [COLOR=#0000ff]In[/COLOR] Worksheets
    i = i + 1  [COLOR=#008000]'Note 1 is Sunday, 2 is Monday, etc....[/COLOR]
    ws.Activate
            Range("A1") = WeekdayName(i)
[COLOR=#0000ff]    Next[/COLOR] ws
[COLOR=#0000ff]End Sub[/COLOR]

To Start On Monday Just Set i = 1 Then use i = i + 1
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,287
Messages
6,171,201
Members
452,390
Latest member
kemafa77

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