Houstonking
New Member
- Joined
- Jul 12, 2016
- Messages
- 41
Hello I have below Data - and my end goal is to reach the data in next column - I have already recorded the macro but I want it to run till there is data on the left hand column - in my example I have only 20 rows.
so what I am doing I just takin left data and adding it"" example - if 123 --- then "123",
<colgroup><col width="64" style="width: 48pt;" span="2"><tbody>
</tbody>Sub CellQuery()
'
' CellQuery Macro
'
'
ActiveCell.Offset(0, 1).Columns("A:A").EntireColumn.Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
ActiveCell.Select
ActiveCell.FormulaR1C1 = "Query"
ActiveCell.Offset(1, 0).Range("A1").Select
ActiveCell.FormulaR1C1 = "=""'""&RC[-1]&""'""&"","""
ActiveCell.Select
Selection.AutoFill Destination:=ActiveCell.Range("A1:A20")
ActiveCell.Range("A1:A20").Select
End Sub
so how can remove the A1:A20 till it sees at on left hand for how many rows it has.
so what I am doing I just takin left data and adding it"" example - if 123 --- then "123",
Data | Query |
334 | '334', |
667 | '667', |
75757 | '75757', |
35353 | '35353', |
887 | '887', |
254546 | '254546', |
6555 | '6555', |
4343434 | '4343434', |
4432323 | '4432323', |
3233223 | '3233223', |
334 | '334', |
667 | '667', |
75757 | '75757', |
35353 | '35353', |
887 | '887', |
254546 | '254546', |
6555 | '6555', |
4343434 | '4343434', |
4432323 | '4432323', |
3233223 | '3233223', |
<colgroup><col width="64" style="width: 48pt;" span="2"><tbody>
</tbody>
'
' CellQuery Macro
'
'
ActiveCell.Offset(0, 1).Columns("A:A").EntireColumn.Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
ActiveCell.Select
ActiveCell.FormulaR1C1 = "Query"
ActiveCell.Offset(1, 0).Range("A1").Select
ActiveCell.FormulaR1C1 = "=""'""&RC[-1]&""'""&"","""
ActiveCell.Select
Selection.AutoFill Destination:=ActiveCell.Range("A1:A20")
ActiveCell.Range("A1:A20").Select
End Sub
so how can remove the A1:A20 till it sees at on left hand for how many rows it has.