ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Travel through no of sheets in a workbook. (https://www.excelbanter.com/excel-programming/398234-travel-through-no-sheets-workbook.html)

Raj[_11_]

Travel through no of sheets in a workbook.
 
Hi all,

I'm facing with a problem can any one help me on the issue
that i'm facing which is explained further.I'm working on an Hr report
which has 30 sheets in in and in a loop i would like to travel up till
the 25th sheet and while i'm travelling i would like to write some
data in to each sheets can any one provide me with an solution for
this problem.


JW[_2_]

Travel through no of sheets in a workbook.
 
Sub thshets()
For i = 1 To 25
Sheets(i).Cells(1, 1).Value = "Something"
Next i
End Sub

Raj wrote:
Hi all,

I'm facing with a problem can any one help me on the issue
that i'm facing which is explained further.I'm working on an Hr report
which has 30 sheets in in and in a loop i would like to travel up till
the 25th sheet and while i'm travelling i would like to write some
data in to each sheets can any one provide me with an solution for
this problem.



[email protected]

Travel through no of sheets in a workbook.
 
Well, without mroe information than that, here's a basic place to
start:

Private Sub DoSomething()
Dim w As Worksheet

For Each w In ActiveWorkbook.Sheets
'this next line stops the code from
'running after sheet 25
If w.Index 25 Then Exit Sub
'code here to write something to
'a sheet as you're passing through.
'for example:
Range("A1").Value = w.Name
Next
End Sub

Hope that helps!

Cory


On Sep 27, 7:07 am, Raj wrote:
Hi all,

I'm facing with a problem can any one help me on the issue
that i'm facing which is explained further.I'm working on an Hr report
which has 30 sheets in in and in a loop i would like to travel up till
the 25th sheet and while i'm travelling i would like to write some
data in to each sheets can any one provide me with an solution for
this problem.




Raj[_11_]

Travel through no of sheets in a workbook.
 
On Sep 27, 5:17 pm, "
wrote:
Well, without mroe information than that, here's a basic place to
start:

Private Sub DoSomething()
Dim w As Worksheet

For Each w In ActiveWorkbook.Sheets
'this next line stops the code from
'running after sheet 25
If w.Index 25 Then Exit Sub
'code here to write something to
'a sheet as you're passing through.
'for example:
Range("A1").Value = w.Name
Next
End Sub

Hope that helps!

Cory

On Sep 27, 7:07 am, Raj wrote:



Hi all,


I'm facing with a problem can any one help me on the issue
that i'm facing which is explained further.I'm working on an Hr report
which has 30 sheets in in and in a loop i would like to travel up till
the 25th sheet and while i'm travelling i would like to write some
data in to each sheets can any one provide me with an solution for
this problem.- Hide quoted text -


- Show quoted text -


thanks a lot for ur valuable solution


[email protected]

Travel through no of sheets in a workbook.
 
On Sep 27, 7:17 am, "
wrote:
Well, without mroe information than that, here's a basic place to
start:

Private Sub DoSomething()
Dim w As Worksheet

For Each w In ActiveWorkbook.Sheets
'this next line stops the code from
'running after sheet 25
If w.Index 25 Then Exit Sub
'code here to write something to
'a sheet as you're passing through.
'for example:
Range("A1").Value = w.Name
Next
End Sub

Hope that helps!

Cory

On Sep 27, 7:07 am, Raj wrote:



Hi all,


I'm facing with a problem can any one help me on the issue
that i'm facing which is explained further.I'm working on an Hr report
which has 30 sheets in in and in a loop i would like to travel up till
the 25th sheet and while i'm travelling i would like to write some
data in to each sheets can any one provide me with an solution for
this problem.- Hide quoted text -


- Show quoted text -


I'm glad it helped. Have a great week.



All times are GMT +1. The time now is 11:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com