K
Kendra
Hey,
I have successfully used this macro to take information from one worksheet
to another, however I need to be able to do this with multiple in the same
workbook.
In one workbook I have four master worksheets and in each master worksheet
there are names in column A which have corrosponding worksheets. I need to
have the row connected to the name in the masters copied into each
corrosponding worksheet and these names may be changed throughout the day
weekly in the master sheets.
This is the formula for the macro I used to do this with one name:
Sub copyit()
Dim MyRange, MyRange1 As Range
Sheets("LIA").Select
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
Set MyRange = Sheets("LIA").Range("A1:A400" & lastrow)
For Each c In MyRange
If c.Value = "ST" Then
If MyRange1 Is Nothing Then
Set MyRange1 = c.EntireRow
Else
Set MyRange1 = Union(MyRange1, c.EntireRow)
End If
End If
Next
If Not MyRange1 Is Nothing Then
MyRange1.Copy
End If
Sheets("ST").Select
Range("A1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
End Sub
'LIA' is one of the master sheets and 'ST' is the name I had it copy from
column A into the worksheet titled 'ST', I have about 13 of these names just
in the master LIA and each have their own worksheet and then 3 other master
sheets with their own names and corrosponding worksheets all in one workbook.
Can I make changes to the existing macro formula to allow for this
complicated need or do I have to make 20 different macros?
If someone could be a genius and help me sort this out I would be in awe.
I have successfully used this macro to take information from one worksheet
to another, however I need to be able to do this with multiple in the same
workbook.
In one workbook I have four master worksheets and in each master worksheet
there are names in column A which have corrosponding worksheets. I need to
have the row connected to the name in the masters copied into each
corrosponding worksheet and these names may be changed throughout the day
weekly in the master sheets.
This is the formula for the macro I used to do this with one name:
Sub copyit()
Dim MyRange, MyRange1 As Range
Sheets("LIA").Select
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
Set MyRange = Sheets("LIA").Range("A1:A400" & lastrow)
For Each c In MyRange
If c.Value = "ST" Then
If MyRange1 Is Nothing Then
Set MyRange1 = c.EntireRow
Else
Set MyRange1 = Union(MyRange1, c.EntireRow)
End If
End If
Next
If Not MyRange1 Is Nothing Then
MyRange1.Copy
End If
Sheets("ST").Select
Range("A1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
End Sub
'LIA' is one of the master sheets and 'ST' is the name I had it copy from
column A into the worksheet titled 'ST', I have about 13 of these names just
in the master LIA and each have their own worksheet and then 3 other master
sheets with their own names and corrosponding worksheets all in one workbook.
Can I make changes to the existing macro formula to allow for this
complicated need or do I have to make 20 different macros?
If someone could be a genius and help me sort this out I would be in awe.