Naming a cell

fahimip

New Member
Joined
Sep 27, 2006
Messages
35
I need to name a cell so that i can copy a range using the named cell as a reference.
the named cell will change every time the loop is completed.

heres what ive got so far:


Sub test()

Sheets("HD").Select
Range("G3").Select
Selection.End(xlDown).Select
ActiveCell.Offset(-1, 0).Select
mycell = ActiveCell
Range("E3:" & mycell).Select
Selection.copy
Range("A65536").Select
Selection.End(xlUp).Select
ActiveCell.Offset(1, 0).Select
Selection.Paste

End Sub

Any ideas?
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Hi

This is one way you could reproduce the code you have:

Code:
Sub Test()
With Sheets("HD")
   Set myCell = .Range("G3").End(xlDown).Offset(-1,0)
   .Range("E3:" & myCell.Address).Copy Destination:=.Range("A65536").End(xlUp).Offset(1,0)
End With
End Sub

Best regards

Richard
 
Upvote 0

Forum statistics

Threads
1,214,587
Messages
6,120,406
Members
448,958
Latest member
Hat4Life

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top