F
Frank Kim
Hi All,
I just joined the news group and this is my first question. Please
help...^^;
How do I reference an ActiveCell? Is it possible to use the address of an
active cell instead of specifying a cell below? Active cell for the example
below is Cells(1, 1) and I need to reference that with, for example, "c1".
Sub copyrange()
Workbooks("B.xls").Worksheets("Sheet1").Activate
Workbooks("B.xls").Worksheets("Sheet1").Cells(1, 1).Select
Set c1 = ActiveCell
Set mc1 = Workbooks("B.xls").Worksheets("Sheet1").Cells(1, 1)
MsgBox mc1.Address()
End Sub
How do I reference the range? Basically, I want to use the addresses of two
cells as a reference for a copy range. Ultimately, I am trying to
find/locate a copy range, which is dynamic.
Sub copyrange()
Workbooks("B.xls").Worksheets("Sheet1").Activate
Workbooks("B.xls").Worksheets("Sheet1").Cells(1, 1).Select
Set mc1 = Workbooks("B.xls").Worksheets("Sheet1").Cells(1, 1)
ActiveCell.Offset(2, 2).Activate
Set mc2 = Workbooks("B.xls").Worksheets("Sheet1").Cells(3, 3)
Dim Rng1 As Range, Rng2 As Range
Set Rng1 =
Workbooks("B.xls").Sheets("Sheet1").Range("mc1.Address:mc2.Address")
Set Rng2 = Workbooks("B.xls").Sheets("Sheet2").Range("A1")
Rng1.Copy Rng2
End Sub
Thank you,
Frank
I just joined the news group and this is my first question. Please
help...^^;
How do I reference an ActiveCell? Is it possible to use the address of an
active cell instead of specifying a cell below? Active cell for the example
below is Cells(1, 1) and I need to reference that with, for example, "c1".
Sub copyrange()
Workbooks("B.xls").Worksheets("Sheet1").Activate
Workbooks("B.xls").Worksheets("Sheet1").Cells(1, 1).Select
Set c1 = ActiveCell
Set mc1 = Workbooks("B.xls").Worksheets("Sheet1").Cells(1, 1)
MsgBox mc1.Address()
End Sub
How do I reference the range? Basically, I want to use the addresses of two
cells as a reference for a copy range. Ultimately, I am trying to
find/locate a copy range, which is dynamic.
Sub copyrange()
Workbooks("B.xls").Worksheets("Sheet1").Activate
Workbooks("B.xls").Worksheets("Sheet1").Cells(1, 1).Select
Set mc1 = Workbooks("B.xls").Worksheets("Sheet1").Cells(1, 1)
ActiveCell.Offset(2, 2).Activate
Set mc2 = Workbooks("B.xls").Worksheets("Sheet1").Cells(3, 3)
Dim Rng1 As Range, Rng2 As Range
Set Rng1 =
Workbooks("B.xls").Sheets("Sheet1").Range("mc1.Address:mc2.Address")
Set Rng2 = Workbooks("B.xls").Sheets("Sheet2").Range("A1")
Rng1.Copy Rng2
End Sub
Thank you,
Frank