View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Jef Gorbach[_2_] Jef Gorbach[_2_] is offline
external usenet poster
 
Posts: 65
Default Macro to copy paste values based on cell input ...

Need more details/samples to work with, but did spot a couple of
things:
1. your code copies several column while your description says the
range is within a single column,
2. it sounds like your coping the selected rang to an unspecified
someplace else.
3. consider using a Select Case rather than an unwieldy 12-stage
If...then...else construct.

Sub PVPrImpct()
'Dim dmonth As Range
Dim SourceRange as Range

Set dmonth = Worksheets("Price Impact by Month").Range("A44")
select case dmonth
case 1 : SourceRange = Range("B48:B74")
case 2 : SourceRange = Range("C48:C74")
'etc
end case
SourceRange.copy Destination:= Range("xxxx").PasteSpecial
Paste:=xlPasteValues
Application.CutCopyMode=False

....