deletedalien
Well-known Member
- Joined
- Dec 8, 2008
- Messages
- 505
- Office Version
- 2013
- Platform
- Windows
Hi all,
i've got a macro code that i recorded and patched to help with my day to day reporting but it still has a lot of manual work, because i have to run this macro over and over and over...
I also have another macro to run whenever there is a date change in the data (you will notice this because there is no campaign right above the date and there would be another date in there...
This isnt too much manual work but when i have to run a months worth of data it gets really tedious....
So here is my code.
(i know.. it isn't much but i'm not really VBA savvy...
)
so in essence what i need is simple:
Add 2 columns before column "A"
move the campaign name 2 columns to the left and 2 cells down from its current location
Copy it down as many times as needed (see file)
move date 1 column to the left of the times column (times shown as 06:00 - 06:30 ) and format it as date
copy date down as many times as needed and move to the next range which could be a campaign change or date change and proceed as shown in file.
Finally stop the loop when the word "Page" is found. or just stop when there's more than 2 black cells below the data or something.
This should all make a whole lot more sense when you see my file:
https://www.dropbox.com/s/62nnokrh07j5nn4/Raw Data.xlsx?dl=0
i would highly appreciate ANY help provided with this as you would be saving me AGES worth of time (especially on month end reporting dates)
i've got a macro code that i recorded and patched to help with my day to day reporting but it still has a lot of manual work, because i have to run this macro over and over and over...
I also have another macro to run whenever there is a date change in the data (you will notice this because there is no campaign right above the date and there would be another date in there...
This isnt too much manual work but when i have to run a months worth of data it gets really tedious....
So here is my code.
(i know.. it isn't much but i'm not really VBA savvy...
Code:
Sub Copy_campaign()
Selection.copy
Selection.End(xlToLeft).Offset(2, 0).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Selection.End(xlUp).Select
Selection.copy
Range(Selection, Selection.End(xlDown).Offset(-5)).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Selection.End(xlDown).Select
Selection.End(xlDown).Offset(-1, 2).Select
'Copy Date
Selection.copy
Selection.End(xlDown).Select
ActiveCell.Offset(rowOffset:=0, columnOffset:=-1).Activate
Range(Selection, Selection.End(xlUp).Offset(5)).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
On Error Resume Next
Application.CutCopyMode = False
Selection.End(xlUp).Offset(0, 1).Select
Selection.End(xlDown).Select
Selection.End(xlDown).Select
Selection.End(xlDown).Select
End Sub
so in essence what i need is simple:
Add 2 columns before column "A"
move the campaign name 2 columns to the left and 2 cells down from its current location
Copy it down as many times as needed (see file)
move date 1 column to the left of the times column (times shown as 06:00 - 06:30 ) and format it as date
copy date down as many times as needed and move to the next range which could be a campaign change or date change and proceed as shown in file.
Finally stop the loop when the word "Page" is found. or just stop when there's more than 2 black cells below the data or something.
This should all make a whole lot more sense when you see my file:
https://www.dropbox.com/s/62nnokrh07j5nn4/Raw Data.xlsx?dl=0
i would highly appreciate ANY help provided with this as you would be saving me AGES worth of time (especially on month end reporting dates)
Last edited: