Hello Friends
Please can any one help me in writing a macro, which copies the column contents in to a text file.
the idea here is, i should give a columname as a parameter to my macro, then it should copy the contents of that columnname to a text file
Please give me some inputs
Thanks in Advance
Vinay
Please help me with this macro
Thanks
vinay
Hi Friends
Please help me with this macro
Thanks in Advance
Vinay
Hi vinaynagasani
What do you have so far?
regards pike
If the solution helped please donate here to the RSPCA
Sites worth visiting;
J&R Solutions - royUK
AJP Excel Information - Andy Pope
Spreadsheet Toolbox
JBeaucaires Excel Files
VBA for smarties - snb
In the following macro, I am copying the Kth column entries in all sheets to a text file
Sub WorksheetLoop()
Dim I As Integer
Dim J As Long
For I = 1 To Sheets.Count
H = 11
Open "C:\temp\abc.txt" For Append As 1
For J = 2 To Sheets(I).Range("K65000").End(xlUp).Row + 1
TestVal = Sheets(I).Cells(J, H).Value
If Len(Sheets(I).Cells(J, H).Value) = 0 Then
GoTo label1
End If
Print #1, TestVal
label1: Next J
Close #1
Next I
End Sub
Hey vinaynagasan
first a little house keeping can you add the code tags to your post
been preoccupied but try...
we can modify to suitCode:Sub ptest() Open ThisWorkbook.Path & "\ptest.txt" For Output As #1 For Each ws In Worksheets ws.Activate ii = ws.Cells(Rows.Count, 9).End(xlUp).Row For r = 1 To ii data = Cells(r, 9).Value Write #1, data '; Next r Next ws Close #1 End Sub
regards pike
If the solution helped please donate here to the RSPCA
Sites worth visiting;
J&R Solutions - royUK
AJP Excel Information - Andy Pope
Spreadsheet Toolbox
JBeaucaires Excel Files
VBA for smarties - snb
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks