Hi all,
I have multiple worksheets that starts from row 3 that I write to text to. Only 2 columns. But every 10th row I want to insert a different text as separator. I tried For statement with Step 11 but it prints more than required. But if I hard code the number like row = 11 or row = 21 or row = 31 and so on then it works except there is uncertainty of the amount for me to write the row = ?? statement.
My current code is
I would like to change that "If wsrows = wsrows 12 Or ..." statement to something dynamic that will write a line every 10th or 11th line in the text file. I am not sure the math calculation to do for this. Hope my explanation is clear?
Thanx in advance...
I have multiple worksheets that starts from row 3 that I write to text to. Only 2 columns. But every 10th row I want to insert a different text as separator. I tried For statement with Step 11 but it prints more than required. But if I hard code the number like row = 11 or row = 21 or row = 31 and so on then it works except there is uncertainty of the amount for me to write the row = ?? statement.
My current code is
Code:
Print #1, " .WaitForEvent rcEnterPos, ""30"", ""0"", 7, 36"
Print #1, " .WaitForDisplayString ""126"", ""30"", 7, 25"
Print #1, " .TransmitANSI """ & Format(Replace(MyExtract(ws1.Name, 2, "B", " "), ".", "/"), "ddmmmyyyy") & stn & """"
wsrowcnt = Range("A65536").End(xlUp).Row
For wsrows = i To wsrowcnt
Print #1, " .TransmitANSI """ & Trim(Cells(wsrows, 1).Value) & Trim(Cells(wsrows, 2).Value) & """"
Print #1, " .TransmitTerminalKey rcIBMFieldPlusKey"
If wsrowcnt - 2 > 10 Then
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
If wsrows = 12 Or wsrows = 22 Or wsrows = 32 Or wsrows = 42 Then
Print #1, " .TransmitTerminalKey rcIBMPageDownKey"
Print #1, " .WaitForEvent rcKbdEnabled, ""30"", ""0"", 1, 1"
Print #1, " .WaitForEvent rcEnterPos, ""30"", ""0"", 7, 36"
Print #1, " .WaitForDisplayString ""126"", ""30"", 7, 25"
Print #1, " .TransmitTerminalKey rcIBMTabKey"
Print #1, " .TransmitTerminalKey rcIBMTabKey"
Print #1, " .TransmitTerminalKey rcIBMTabKey"
Print #1, " .TransmitTerminalKey rcIBMTabKey"
End If
End If
Next wsrows
I would like to change that "If wsrows = wsrows 12 Or ..." statement to something dynamic that will write a line every 10th or 11th line in the text file. I am not sure the math calculation to do for this. Hope my explanation is clear?
Thanx in advance...