Posted on 2014-02-22
can you please help,
I'm trying to use below code to get each sheet saved.
I get the sheets saved, but each sheet has the information from previous sheet as well.
sheet 1 is ok,
sheet 2, it is saving sheet 1 range + sheet 2 range
sheet 3 is saving sheet 1 range + sheet 2 range + sheet 3 range
and so on.
I need each sheet with only the range in the sheet.
Dim wshH As Worksheet
Dim c As Range, r As Range
Dim output As String
Dim LastRowW As Long
For Each wshH In Worksheets
If wshH.Name <> "58" And wshH.Name <> "1" Then
LastRowW = Range("A" & Rows.Count).End(xlUp).Row
With Range("A2:A" & LastRowW).Select
For Each r In Range("A2:A" & LastRowW).Rows
For Each c In r.Cells
output = output & "'" & c.Value & "',"
output = output '& vbNewLine
Open "C:\Users\Wassim\Desktop\" & wshH.Name & ".txt" For Output As #1
Print #1, output