Hey All,
trying to format some data on multiple tabs
i've got select range selected via an input box as it varies each month. but the same range is required over 2 tabs.
I need to have the selected code to perform over both tabs 'ADL' and 'SYD'
can anyone advise why this isn't working or a workaround for it? do i need to set another rng variable for the 2nd tab? if so can i duplicate the inputbox result to this variable?
trying to format some data on multiple tabs
i've got select range selected via an input box as it varies each month. but the same range is required over 2 tabs.
I need to have the selected code to perform over both tabs 'ADL' and 'SYD'
can anyone advise why this isn't working or a workaround for it? do i need to set another rng variable for the 2nd tab? if so can i duplicate the inputbox result to this variable?
Code:
Sub percent2()
dim rng as range
Set rng = Application.InputBox(Prompt:="Range in Column I for the Month", Title:="Range Select", Type:=8)
For Each rng In rng
Worksheets("ADL").Activate
If rng <> "" Then
rng.Value = Format((rng.Value / 100))
rng.NumberFormat = "0%"
rng.Offset(0, -1).Value = Format((rng.Offset(0, -1).Value / 100))
rng.Offset(0, -1).NumberFormat = "0%"
rng.Offset(0, -2).Value = Format((rng.Offset(0, -2).Value / 100))
rng.Offset(0, -2).NumberFormat = "0%"
rng.Offset(0, -3).Copy
rng.Offset(0, 1).PasteSpecial
End If
Next
Worksheets("SYD").Activate
If rng <> "" Then
rng.Value = Format((rng.Value / 100))
rng.NumberFormat = "0%"
rng.Offset(0, -1).Value = Format((rng.Offset(0, -1).Value / 100))
rng.Offset(0, -1).NumberFormat = "0%"
rng.Offset(0, -2).Value = Format((rng.Offset(0, -2).Value / 100))
rng.Offset(0, -2).NumberFormat = "0%"
rng.Offset(0, -3).Copy
rng.Offset(0, 1).PasteSpecial
End If
Next
end sub