L
Legacy 363566
Guest
Hello!
I have been working on this issue all day, so I am hoping someone here is able to help. I am trying to create a VBA script that will allow me to easily complete a copy > paste special (transpose) operation.
1. I need to select a custom range of data
2. Loop through the data by row
2.1 If the cell of the first column is not null I need to check if there is data in the following columns
2.2 If there is data in the following columns, I need all the data to be copied
3. I need to do a special paste of the data, so it can be transposed, below the cell in the first column of the row
Here is an illustration of what I am saying:
https://drive.google.com/open?id=0B7RoI5-NVRVfMEFTRmp2b3lyeEk
Here is what the spreadsheet needs to look like once the script has completed:
https://drive.google.com/open?id=0B7RoI5-NVRVfUDJtMmZQd0h1bjg
Here is my code (I get runtime error):
Thank you in advance!
PS: I am using Excel 2011 on a Mac
I have been working on this issue all day, so I am hoping someone here is able to help. I am trying to create a VBA script that will allow me to easily complete a copy > paste special (transpose) operation.
1. I need to select a custom range of data
2. Loop through the data by row
2.1 If the cell of the first column is not null I need to check if there is data in the following columns
2.2 If there is data in the following columns, I need all the data to be copied
3. I need to do a special paste of the data, so it can be transposed, below the cell in the first column of the row
Here is an illustration of what I am saying:
https://drive.google.com/open?id=0B7RoI5-NVRVfMEFTRmp2b3lyeEk
Here is what the spreadsheet needs to look like once the script has completed:
https://drive.google.com/open?id=0B7RoI5-NVRVfUDJtMmZQd0h1bjg
Here is my code (I get runtime error):
Code:
<code>Sub PhotoColumnsToRows()
'We need to know where the photo URL's are located
Dim rng As Range
Set rng = Application.InputBox(Prompt:= _
"Please select a range.", _
Title:="SPECIFY RANGE", Type:=8)
'Now we need to scan the range of data for URL's, skipping blank rows/cells
For Each row In rng
If Not IsNull(rng.Column) Then
copyRow = rng.row
Rows(copyRow & ":" & copyRow).Select
Selection.Copy
Sheets("Sheet2").Select
ActiveSheet.Rows(copyRow).Select
ActiveSheet.PasteSpecial Transpose:=True
Sheets("Sheet1").Select
End If
Next row
End Sub</code>
Thank you in advance!
PS: I am using Excel 2011 on a Mac