Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub Main
- 'Declare all needed variables
- Dim s, cs, y, w
- 'Get all document's sheets
- s = ThisComponent.Sheets
- 'Walk over all document's sheets
- For i = 0 To s.getCount()-1
- 'Get the current sheet (cs stands for CurrentSheet)
- cs = s.getByIndex(i)
- 'Get the year cell (here B5 cell)
- y = cs.getCellRangeByName("B5") 'Change here with year cell name
- 'Get the week cell (here B6 cell)
- w = cs.getCellRangeByName("B6").String 'Change here with month cell name
- 'If week number is lower than 10 add a leading "0" char
- If CInt(w) < 10 Then
- w = "0" & w
- End If
- 'Change the current sheet's name with "yyyy-ww"
- cs.Name = y.String & "-" & w
- Next i
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement