Hello Everyone, thank you in advance for your help.
Basically what i am trying to do is copy all data from Columns M to Column T starting from Row 3 and paste it into a new worksheet. The hard part is that some cell values can be blank in between rows. So essentially id like to copy all values without any blanks into the new worksheet. My current script looks at the whole range instead of starting at M3.
If its not too much trouble, id also like to output the newly pasted data to a .SQL file and save it in a certain directory.
Example:
[TABLE="width: 150"]
<tbody>[TR]
[TD]Update[/TD]
[TD]Start[/TD]
[TD]End[/TD]
[TD]Remove[/TD]
[TD]Volume[/TD]
[TD]Cost[/TD]
[TD]Append[/TD]
[TD]Void[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]D[/TD]
[TD]G[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]D[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]D[/TD]
[TD]G[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]D[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD][/TD]
[TD]G[/TD]
[TD][/TD]
[TD]C[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD][/TD]
[TD]G[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]D[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]D[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Basically what i am trying to do is copy all data from Columns M to Column T starting from Row 3 and paste it into a new worksheet. The hard part is that some cell values can be blank in between rows. So essentially id like to copy all values without any blanks into the new worksheet. My current script looks at the whole range instead of starting at M3.
If its not too much trouble, id also like to output the newly pasted data to a .SQL file and save it in a certain directory.
Code:
Sub CopyData()
' CopyData Macro
Dim x As Integer
Dim y As Integer
x = 1
y = 1
Do Until Worksheets("Datafix").Range("M" & x) = ""
Worksheets("SQLScript").Range("A" & y) = Worksheets("Datafix").Range("M" & x)
y = y + 1
x = x + 1
Loop
End Sub
Example:
[TABLE="width: 150"]
<tbody>[TR]
[TD]Update[/TD]
[TD]Start[/TD]
[TD]End[/TD]
[TD]Remove[/TD]
[TD]Volume[/TD]
[TD]Cost[/TD]
[TD]Append[/TD]
[TD]Void[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]D[/TD]
[TD]G[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]D[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]D[/TD]
[TD]G[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]D[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD][/TD]
[TD]G[/TD]
[TD][/TD]
[TD]C[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD][/TD]
[TD]G[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]D[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]D[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]