Using paste in macro but with variable references.

  • Thread starter Thread starter JamieD
  • Start date Start date
J

JamieD

Hi all,
I am trying to use the paste function in a macro but it needs to be
variable.
I have split a list of data (team workloads) into the seperate teams
and by days of the week. I now need the macro to compile one book with
all the data in order.
The headings for each team are already set on a worksheet so the data
needs to be entered under each heading For example:

Team A Day 1 under the heading "Team A Day 1", Team B Day 1 under the
next heading on the same sheet "Team B Day 1".

I hit problems as the workload ammount will alter from week to week. So
of course asking the macro to insert the data in ref N1117 will only
work one week and will change for the next.
If any one has any ideas they would be much apreciated.

Many Thanks

J
 
This is a simple example of how you could use Find And Offset to paste to
the right range. Perhaps you could adapt this to your situation.

Sub a()
Dim PasteRg As Range
Set PasteRg = Worksheets("Sheet1").Cells.Find("Team A Day 1")
If PasteRg Is Nothing Then
MsgBox "Cannot find range"
Else
Range("A1").Copy PasteRg.Offset(1)
End If
End Sub
 
Back
Top