edwardvolpe2012
New Member
- Joined
- Jan 21, 2022
- Messages
- 2
- Office Version
- 365
- Platform
- Windows
Hi all,
I'm creating a VBA code to transpose some information for me.
Breakdown of the data
Column A is a code or SKU
C1:E1 are production dates
C2:A4 are volumes
Ultimately the code I've written below tells me when production is starting for each code and populates the date of production start in column B
So for example if you look at row 2 the code will find the first cell with data in it, jump to the top row, pull the date, and place it in column B
I've gotten the code to work but I over 200 rows to apply this too (I've already done this and encountering compile error if I go over a 250 rows).
Instead of writing code for the next row / iteration 200 + times, I want to know if there is a way to repeat the code to each row.
I've been trying loop functions but cant figure it out, any help would be greatly appreciated.
Before Macro Run
End Result
For example:
Sub Macro1()
Range("A2").Select
Selection.End(xlToRight).Select
ActiveCell.EntireColumn.Select
Selection.End(xlUp).Select
Selection.Copy
Range("B2").Select
ActiveSheet.Paste
Range("A3").Select
Selection.End(xlToRight).Select
ActiveCell.EntireColumn.Select
Selection.End(xlUp).Select
Selection.Copy
Range("B3").Select
ActiveSheet.Paste
Range("A4").Select
Selection.End(xlToRight).Select
ActiveCell.EntireColumn.Select
Selection.End(xlUp).Select
Selection.Copy
Range("B4").Select
ActiveSheet.Paste
End Sub
I'm creating a VBA code to transpose some information for me.
Breakdown of the data
Column A is a code or SKU
C1:E1 are production dates
C2:A4 are volumes
Ultimately the code I've written below tells me when production is starting for each code and populates the date of production start in column B
So for example if you look at row 2 the code will find the first cell with data in it, jump to the top row, pull the date, and place it in column B
I've gotten the code to work but I over 200 rows to apply this too (I've already done this and encountering compile error if I go over a 250 rows).
Instead of writing code for the next row / iteration 200 + times, I want to know if there is a way to repeat the code to each row.
I've been trying loop functions but cant figure it out, any help would be greatly appreciated.
Before Macro Run
End Result
For example:
Sub Macro1()
Range("A2").Select
Selection.End(xlToRight).Select
ActiveCell.EntireColumn.Select
Selection.End(xlUp).Select
Selection.Copy
Range("B2").Select
ActiveSheet.Paste
Range("A3").Select
Selection.End(xlToRight).Select
ActiveCell.EntireColumn.Select
Selection.End(xlUp).Select
Selection.Copy
Range("B3").Select
ActiveSheet.Paste
Range("A4").Select
Selection.End(xlToRight).Select
ActiveCell.EntireColumn.Select
Selection.End(xlUp).Select
Selection.Copy
Range("B4").Select
ActiveSheet.Paste
End Sub