
Originally Posted by
pbabu
Many thanks for your quick reply.
great guys , this is perfectly working. would it be possible to generate a sequence set of values with respect to "P" sheets which means if 1st (P) sheet has a value of "1" then next "P" sheet should contain a value of "2" i,e adding +1 to the next occurrence.
For example :
P Sheet " 1 Minutes -4431 01/01/2013"
S Sheet " 0 Minutes -4431 01/01/2013"
P Sheet " 2 Minutes -4431 01/01/2013"
S Sheet " 0 Minutes -4431 01/01/2013"
Please note there is no change required for "S" sheets.
Does this code do what you want?
Code:
Sub ExcelFoxAndRick()
Dim 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 Rng.Columns(1) = Evaluate("ROW(" & Rng.Address & ")")
Next
End Sub
Bookmarks