parth007
Member
Hello Friends,
I am making a automated package.. i am done with other code..
Just a query
I have Excel Workbook which have many worksheets
what i do here is that I look for Sheet.Range("A1") data i.e. "Transport Plan -" in all sheets and if any sheet have "Transport Plan -" in Sheet.Range("A1") i rename that sheet name to "All Transport_Data"
New changes came in as below...
1) If any sheet.range("A1") = "Transport Plan -" then rename that sheet name to "All Transport_Data"
2) IF we didnot find sheet.range("A1") = "Transport Plan -" in any of the sheets then
Check for new name i.e.
sheet.range("A1") = "All Plan -" then rename that sheet name to "All Transport_Data"
Below if the current code which satisfies first condition.. need to add 2nd condition too.. please suggest
'''''''''''' Code Start
If ActiveWorkbook.Worksheets.Count = 1 Then
ActiveWorkbook.Worksheets(1).Name = "Sheet1"
Else
For Each Sheet In ActiveWorkbook.Worksheets
If Sheet.Range("A1") Like "*Transport*Plan*-*" Then
Sheet.Name = "All Transport_Data"
End If
Exit For
End If
Next Sheet
End If
'''''''''''' Code End
I am making a automated package.. i am done with other code..
Just a query
I have Excel Workbook which have many worksheets
what i do here is that I look for Sheet.Range("A1") data i.e. "Transport Plan -" in all sheets and if any sheet have "Transport Plan -" in Sheet.Range("A1") i rename that sheet name to "All Transport_Data"
New changes came in as below...
1) If any sheet.range("A1") = "Transport Plan -" then rename that sheet name to "All Transport_Data"
2) IF we didnot find sheet.range("A1") = "Transport Plan -" in any of the sheets then
Check for new name i.e.
sheet.range("A1") = "All Plan -" then rename that sheet name to "All Transport_Data"
Below if the current code which satisfies first condition.. need to add 2nd condition too.. please suggest
'''''''''''' Code Start
If ActiveWorkbook.Worksheets.Count = 1 Then
ActiveWorkbook.Worksheets(1).Name = "Sheet1"
Else
For Each Sheet In ActiveWorkbook.Worksheets
If Sheet.Range("A1") Like "*Transport*Plan*-*" Then
Sheet.Name = "All Transport_Data"
End If
Exit For
End If
Next Sheet
End If
'''''''''''' Code End