Newbie2223
Technical User
Hi All
I found this piece of code that works on the Active Sheet
The problem I have is that my excel workbook was create by someone else
and populates over 5 sheets..once I open the workbook.
I would like to build a macro to auto copy sheet 3, 4 and 5 only
How or what do I have to add to get the below code to
loop thru sheet 3, 4 and 5
Sub SaveAsPipeDelimited()
Dim r, c As Integer
Close
Open "C:\Just_Text.txt" For Append As #1
With ActiveSheet.UsedRange
For r = 1 To .Rows.Count
For c = 1 To .Columns.Count - 1
Print #1, .Cells(r, c); "|";
Next c
Print #1, .Cells(r, .Columns.Count)
Next r
End With
Close #1
End Sub
Any help is greatly appreciated
Thanks Newbie2223
I found this piece of code that works on the Active Sheet
The problem I have is that my excel workbook was create by someone else
and populates over 5 sheets..once I open the workbook.
I would like to build a macro to auto copy sheet 3, 4 and 5 only
How or what do I have to add to get the below code to
loop thru sheet 3, 4 and 5
Sub SaveAsPipeDelimited()
Dim r, c As Integer
Close
Open "C:\Just_Text.txt" For Append As #1
With ActiveSheet.UsedRange
For r = 1 To .Rows.Count
For c = 1 To .Columns.Count - 1
Print #1, .Cells(r, c); "|";
Next c
Print #1, .Cells(r, .Columns.Count)
Next r
End With
Close #1
End Sub
Any help is greatly appreciated
Thanks Newbie2223