Macro - Copy from one page a return to starting page problem.

  • Thread starter Thread starter SomeOneInFL
  • Start date Start date
S

SomeOneInFL

Ok Im a bit stumped. I am building a work book that data on a shee
called worksheet is changed every day. Certain parts of that data nee
to go to a sheet called Feb (and the rest of the months as each da
comes by) Problem is I will need to do 356 macros and buttons t
accomplish this. But I know there has to be an easier way. Right no
the macro is:
Sub Move1()
'
' Move1 Macro
Sheets("WorkSheet").Select
Range("D10:D205").Select
Selection.Copy
Sheets("Feb").Select
Range("C10").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone
SkipBlanks:= _
False, Transpose:=False
Range("C8:C9").Select
End Sub


Is there a way to work in to that where instead of
Sheets("Feb").Select something to select the previous active shee
which would be where the button was clicked. Then I would only need 3
of them since the format for each month is the same.

Thanks
 
I'm not quite sure what's going on, but you could eliminate the selects and just
work with the ranges:

Option Explicit
Sub Move1A()

Worksheets("worksheet").Range("d10:d205").Copy
ActiveSheet.Range("c10").PasteSpecial Paste:=xlValues, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False

End Sub

In fact, since you're just pastespecial values, you could just assign the
values:

Option Explicit
Sub Move1B()

Dim myRng As Range
Set myRng = Worksheets("worksheet").Range("d10:d205")
ActiveSheet.Range("c10") _
.Resize(myRng.Rows.Count, myRng.Columns.Count).Value _
= myRng.Value

End Sub

(these were buttons from the Forms toolbar, I bet/hope.)
 
Back
Top