N
Nina
Hi,
First of all thanks a lot for your assistance. I did spend some time
researching the excel community and trying few codes but I was not able to
find modify one to fit my needs, so I am hoping that someone can help figure
out why the code I wrote below does not work (I know it is not the best
coding possible but if works I am set Any other suggestions are welcome
of course
Cell A44 value changes (1 to 12) based on user selection (month of a date in
another worksheet). =MONTH('Direct Cat_Infl&Perf'!J3)
columns B to M are respectivelly, Jan to Dec and there are formulas in each
column cell( lines 48 to 74. )
I want to, copy/paste values on the specific column based on cell A44. i.e.
if cell A44 = 1 then copy/paste values for the Jan column (range B48:B74), if
A44 = 2 then copy/paste values for column Feb range C48:C74, the report will
change once month only .. I wrote the following but it is not working ....
Sub PVPrImpct()
'
Dim dmonth As Range
Set dmonth = Worksheets("Price Impact by Month").Range("A44")
' Jan
If dmonth = "1" Then
Range("B4874").Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
else
If dmonth = "2" Then
Range("C48:E74").Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
.....
Thanks a lot for your input!
First of all thanks a lot for your assistance. I did spend some time
researching the excel community and trying few codes but I was not able to
find modify one to fit my needs, so I am hoping that someone can help figure
out why the code I wrote below does not work (I know it is not the best
coding possible but if works I am set Any other suggestions are welcome
of course
Cell A44 value changes (1 to 12) based on user selection (month of a date in
another worksheet). =MONTH('Direct Cat_Infl&Perf'!J3)
columns B to M are respectivelly, Jan to Dec and there are formulas in each
column cell( lines 48 to 74. )
I want to, copy/paste values on the specific column based on cell A44. i.e.
if cell A44 = 1 then copy/paste values for the Jan column (range B48:B74), if
A44 = 2 then copy/paste values for column Feb range C48:C74, the report will
change once month only .. I wrote the following but it is not working ....
Sub PVPrImpct()
'
Dim dmonth As Range
Set dmonth = Worksheets("Price Impact by Month").Range("A44")
' Jan
If dmonth = "1" Then
Range("B4874").Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
else
If dmonth = "2" Then
Range("C48:E74").Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
.....
Thanks a lot for your input!