Hello,
I am very new to macros and need assistance with one I am currently working on. I have a script that copies cells in one column and pastes them in the next column. Also there are some paste special- values in there. What I need to occur is that each time I run the macro I need it to shift over one column.
I believe the easiest way to accomplish this is to use a 'LngCnt' and use 'Name Manager' to create a new name to store the 'LngCnt' Value. Here is how I used it in the past- I would start the code with this:
then implement 'LngCnt' after each Range Selection:
This would allow the formula to begin pulling from the 31st column on the 'test' tab. This was followed by
to move the column over by 1 each time the macro is run.
What I am not able to figure out is how to properly adjust my current macro to include the 'LngCnt' function. I would need each Selection to incorporate the 'LngCnt'. Here is where I currently am:
Another part I need assistance on is to adjust the beginning of the formula so that when run it starts at L1:N1 and then next time I run it starts at M1:O1, etc.
If 'LngCnt' is not the easiest way to accomplish this then I am open to suggestions. This is just something I have used in the past and it worked fine.
I do not need the whole formula done for me, but if someone could show me how to adjust just the first 2 cell selections (L1:N1 & M1) I am sure I can apply it to the rest.
Thanks so much in advance!
I am very new to macros and need assistance with one I am currently working on. I have a script that copies cells in one column and pastes them in the next column. Also there are some paste special- values in there. What I need to occur is that each time I run the macro I need it to shift over one column.
I believe the easiest way to accomplish this is to use a 'LngCnt' and use 'Name Manager' to create a new name to store the 'LngCnt' Value. Here is how I used it in the past- I would start the code with this:
Code:
LngCnt = Replace(ActiveWorkbook.Names("valuestore").Value, "=", "")
then implement 'LngCnt' after each Range Selection:
Code:
[COLOR=#333333]startRange.FormulaR1C1 = "=SUMIF('test'!R5C1:R159C1,RC1,'test'!R5C" & 31 + LngCnt & ":R159C" & 31 + LngCnt & ")"
[/COLOR]
This would allow the formula to begin pulling from the 31st column on the 'test' tab. This was followed by
Code:
LngCnt = LngCnt + 1
What I am not able to figure out is how to properly adjust my current macro to include the 'LngCnt' function. I would need each Selection to incorporate the 'LngCnt'. Here is where I currently am:
Code:
ActiveWindow.SmallScroll Down:=-51
Range("L1:N1").Select
Selection.Cut
Range("M1").Select
ActiveSheet.Paste
Range("K1").Select
Selection.Copy
Range("L1").Select
ActiveSheet.Paste
ActiveWindow.SmallScroll Down:=27
Range("N47").Select
ActiveWindow.SmallScroll Down:=12
Range("N47:N60").Select
ActiveWindow.SmallScroll Down:=0
Range("N47").Select
ActiveWindow.SmallScroll Down:=21
Range("N47:N81").Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.SmallScroll Down:=-21
Range("L47").Select
ActiveWindow.SmallScroll Down:=15
Range("L47:L81").Select
Application.CutCopyMode = False
Selection.Copy
ActiveWindow.SmallScroll Down:=-18
Range("M47").Select
ActiveSheet.Paste
ActiveWindow.SmallScroll Down:=0
Range("K47").Select
ActiveWindow.SmallScroll Down:=21
Range("K47:K81").Select
ActiveWindow.SmallScroll Down:=-15
Application.CutCopyMode = False
Selection.Copy
Range("L47").Select
ActiveSheet.Paste
Range("K47").Select
ActiveWindow.SmallScroll Down:=15
Range("K47:K81").Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Another part I need assistance on is to adjust the beginning of the formula so that when run it starts at L1:N1 and then next time I run it starts at M1:O1, etc.
If 'LngCnt' is not the easiest way to accomplish this then I am open to suggestions. This is just something I have used in the past and it worked fine.
I do not need the whole formula done for me, but if someone could show me how to adjust just the first 2 cell selections (L1:N1 & M1) I am sure I can apply it to the rest.
Thanks so much in advance!