Hi Board
This below mentioned script was written to save cell values of a6.. a210 and a1501..a1600 to a text file in g:\ with name text1.txt .
Excel returns me with a Run time error of 1004 ( Method Range of Object _Global Failed)
For Each t In Range("A1501:A1600").Rows
at this line.
Appreciate your help in solving this.
Dim ca As Range, cb As Range, s As Range, t As Range
Dim outputa As String, outputb As String
Dim l1 As String
Dim l2 As String
Dim l3 As String
Dim l4 As String
Dim l5 As String
Dim l6 As String
l1 = "[MARKET_WATCH_GROUP_NAMES]"
l2 = "VALUE=LTD"
l3 = "[LTD]"
l4 = "VALUE="
l5 = "[TOKEN_LIST_MAX_SIZE]"
l6 = "Value = 5000"
For Each s In Range("A6:A210").Rows
For Each ca In s.Cells
outputa = outputa & "nse_cm|" & ca.Value & ","
Next ca
outputa = outputa
'& vbNewLine
Next s
For Each t In Range("A1501:A1600").Rows
For Each cb In t.Cells
outputb = outputb & "nse_fo|" & cb.Value & ","
Next cb
outputb = outputb
'& vbNewLine
Next t
Open "G:\text1.txt" For Output As #1
Print #1 , l1 & vbNewLine & l2 & vbNewLine & l3 & vbNewLine & l4 & outputa & outputb & vbNewLine & l5 & vbNewLine & l6 & vbNewLine
Close
a = MsgBox("ARE YOU DONE UPLOADING?", _
vbYesNo)
If a = vbNo Then Cancel = True
If a = vbYes Then
Range("F501:I1494").Select
This below mentioned script was written to save cell values of a6.. a210 and a1501..a1600 to a text file in g:\ with name text1.txt .
Excel returns me with a Run time error of 1004 ( Method Range of Object _Global Failed)
For Each t In Range("A1501:A1600").Rows
at this line.
Appreciate your help in solving this.
Dim ca As Range, cb As Range, s As Range, t As Range
Dim outputa As String, outputb As String
Dim l1 As String
Dim l2 As String
Dim l3 As String
Dim l4 As String
Dim l5 As String
Dim l6 As String
l1 = "[MARKET_WATCH_GROUP_NAMES]"
l2 = "VALUE=LTD"
l3 = "[LTD]"
l4 = "VALUE="
l5 = "[TOKEN_LIST_MAX_SIZE]"
l6 = "Value = 5000"
For Each s In Range("A6:A210").Rows
For Each ca In s.Cells
outputa = outputa & "nse_cm|" & ca.Value & ","
Next ca
outputa = outputa
'& vbNewLine
Next s
For Each t In Range("A1501:A1600").Rows
For Each cb In t.Cells
outputb = outputb & "nse_fo|" & cb.Value & ","
Next cb
outputb = outputb
'& vbNewLine
Next t
Open "G:\text1.txt" For Output As #1
Print #1 , l1 & vbNewLine & l2 & vbNewLine & l3 & vbNewLine & l4 & outputa & outputb & vbNewLine & l5 & vbNewLine & l6 & vbNewLine
Close
a = MsgBox("ARE YOU DONE UPLOADING?", _
vbYesNo)
If a = vbNo Then Cancel = True
If a = vbYes Then
Range("F501:I1494").Select