I am trying to create a VBA script that would allow me to select a range of data, and then, skipping the first column in the range, move the values the succeeding columns under the first column.
Example current spreadsheet layout:
---------------------------
URL1 | URL2 | URL3 | URL4 |
---------------------------
| | | |
-----+------+------+-------
| | | |
-----+------+------+-------
1URL| 2URL | 3URL | |
-----+------+------+-------
aURL| bURL | | |
---------------------------
You'll notice that not all the cells in the range are populated
Example result spreadsheet (after ruing script):
---------------------------
URL1 | URL2 | URL3 | URL4 |
---------------------------
| | | |
-----+------+------+-------
| | | |
-----+------+------+-------
1URL| | | |
-----+------+------+-------
2URL| | | |
---------------------------
3URL| | | |
-----+------+------+-------
aURL| | | |
-----+------+------+-------
bURL| | | |
-----+------+------+-------
I am beating my brain over the best way to loop through the range, but here is my script code so far:
Sub PhotoColumnsToRows()
'We need to know where the photo URL's are located
Dim g As Range
Dim row As Range
Dim cell As Range
Set g = Selection
'Now we need to scan the range of data for URL's, skipping blank rows/cells
For Each cell In row.Cells
Next cell
End Sub
What is the best way to loop through my data, given the circumstances, and move data per my illustrations?
