Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Cesar Gonzalez   on Jan 31 In MS Office Category.

  
Question Answered By: Devlan Jones   on Jan 31

This should do it:

Sub MoveToYear()

If Range("Year").Value = 2001 Then
Range("Data").Copy
Range("Out1").PasteSpecial Paste:=xlPasteValues
ElseIf Range("Year").Value = 2002 Then
Range("Data").Copy
Range("Out2").PasteSpecial Paste:=xlPasteValues
End If

End Sub

Btw, with more than 2 years in play, a Select Case construction might be
more elegant than Ifs. With more than 10, I'd be looking to make a
string from the year value and converting it into its corresponding
range name.

Share: 

 

This Question has 5 more answer(s). View Complete Question Thread

 


Tagged: