My table is like that;
A header | Another header |
---|---|
First | row |
Second | row |
First | row |
Second | row |
[Here, The blank rows have "".]
I want have a table like this (Values);
A header | Another header |
---|---|
First | row |
Second | row |
First | row |
Second | row |
I wrote code to copy and paste as value to new cells.
Dim i As Long
Dim Rng As Range
'for the first table
ActiveSheet.Range("A3").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Application.CutCopyMode = False
Selection.Copy
ThisWorkbook.Sheets("Sheet1").Range("S3").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Set Rng = ActiveSheet.Range("S3")
'Remove "" values that comes from formula
For i = 1 To 600
If Rng.Cells(i, 1) = "" Then
Rng.Cells(i, 1).ClearContents
End If
Next i
'For the second formula
ActiveSheet.Range("A18").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Application.CutCopyMode = False
Selection.Copy
ThisWorkbook.Sheets("Sheet1").Range("S3").Select
ThisWorkbook.Sheets("Sheet1").Range("S3").End(xlDown).Offset(1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Set Rng = ActiveSheet.Range("S3")
For i = 1 To 600
If Rng.Cells(i, 1) = "" Then
Rng.Cells(i, 1).ClearContents
End If
Next i
'It continues till 39 table....
I have to paste the code for each data group. I have a very long table so I want make it in a loop.