Noone
03-29-2020, 07:13 AM
Hello everyone,
Hope you are all doing good.
So I am working on a macro, the goal is to copy and paste an x cell of the last column added, knowing that each day a column is added till the Column "AX" is reached .
So the idea I had, is to check if the last column (AX) is empty, if yes then I move left with 3 columns, then do again the same thing if it's empty move another time with 3 columns to the left, untill It finds a full cell, then do the copy and paste process. (x = x - 3 )
The problem Is that I don't know how to define the loop to keep doing the check untill it finds a full cell.
I already created a random code but it s not complete and doesn't work.
Sub Test_FM()
Application.ScreenUpdating = False
x = 0
Sheets("Test FM").Select
Range("AX9").Select
If ActiveCell.Value = "" Then
Range("AX9").Activate
ActiveCell.Offset(rowoffset:=0, columnoffset:=x).Activate
x = x - 3
Range("AX9").Select
ActiveCell.Offset(rowoffset:=x, columnoffset:=0).Activate
ActiveSheet.Rows(ActiveCell.Row).Select
Range("AX9").Select
Range("AX9").Activate
ActiveCell.Offset(rowoffset:=x, columnoffset:=0).Activate
Selection.Copy
Sheets("DR 02").Select
Range("M19").Select
Selection.PasteSpecial
ElseIf
IsEmpty(ActiveCell) = False Then
Sheets("Test FM").Select
Range("AX9").Select
Range("AX9").Activate
ActiveCell.Offset(rowoffset:=x, columnoffset:=0).Activate
Selection.Copy
Sheets("DR 02").Select
Range("M19").Select
Selection.PasteSpecial
End IF
End Sub
Thank you
Hope you are all doing good.
So I am working on a macro, the goal is to copy and paste an x cell of the last column added, knowing that each day a column is added till the Column "AX" is reached .
So the idea I had, is to check if the last column (AX) is empty, if yes then I move left with 3 columns, then do again the same thing if it's empty move another time with 3 columns to the left, untill It finds a full cell, then do the copy and paste process. (x = x - 3 )
The problem Is that I don't know how to define the loop to keep doing the check untill it finds a full cell.
I already created a random code but it s not complete and doesn't work.
Sub Test_FM()
Application.ScreenUpdating = False
x = 0
Sheets("Test FM").Select
Range("AX9").Select
If ActiveCell.Value = "" Then
Range("AX9").Activate
ActiveCell.Offset(rowoffset:=0, columnoffset:=x).Activate
x = x - 3
Range("AX9").Select
ActiveCell.Offset(rowoffset:=x, columnoffset:=0).Activate
ActiveSheet.Rows(ActiveCell.Row).Select
Range("AX9").Select
Range("AX9").Activate
ActiveCell.Offset(rowoffset:=x, columnoffset:=0).Activate
Selection.Copy
Sheets("DR 02").Select
Range("M19").Select
Selection.PasteSpecial
ElseIf
IsEmpty(ActiveCell) = False Then
Sheets("Test FM").Select
Range("AX9").Select
Range("AX9").Activate
ActiveCell.Offset(rowoffset:=x, columnoffset:=0).Activate
Selection.Copy
Sheets("DR 02").Select
Range("M19").Select
Selection.PasteSpecial
End IF
End Sub
Thank you