
Originally Posted by
pbabu
Apologies for the confusion.No Rick, the logic that you have provided is basically generating a sequence set of values with in the same sheet but i need other way around which means complete (P) sheet should have same set of value like ("1 Minutes -4431 01/01/2013")
and next occurence of (P) should have incremental value like (" 2 Minutes -4431 01/01/2013).
For example:
FreeP sheet : " 1 Minutes -4431 01/01/2013".
FreeS Sheet : " 0 Minutes -4431 01/01/2013"
CostP Sheet : "" 2 Minutes -4431 01/01/2013"
CostS Sheet : " 0 Minutes -4431 01/01/2013"
Okay then, how about this macro, does it do what you want?
Code:
Sub ExcelFoxAndRick()
Dim Index As Long, Wks As Worksheet, Rng As Range
For Each Wks In ThisWorkbook.Worksheets
Set Rng = Wks.Range("G9:J" & Wks.Cells(Rows.Count, "A").End(xlUp).Row)
If Wks.Name Like "*[PS]" Then Rng = Array(Abs(Wks.Name Like "*P"), "Minutes", -4431, #1/1/2013#)
If Right(Wks.Name, 1) = "P" Then
Index = Index + 1
Rng.Columns(1) = Index
End If
Next
End Sub
Bookmarks