![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Join Date: Jun 2002
Location: North Carolina
Posts: 119
|
I'd like to set up a macro or some code that would select a range of cells that is 8 columns wide by 15 rows high and copy it to clipbaord no matter what particular cell is selected at any given time I might run the macro. In other words, if I had cell A2 selected and I ran the macro, cells in range A2:H16 would be selected then copied to clipboard. If I happened to be in cell K20 and ran the macro, then range K20:R34 would be selected then copied to clipboard. I hope I explained this clearly enough - any ideas???
|
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: San Francisco, California USA
Posts: 9,090
|
Sub Test1()
Dim AR As Long, AC As Integer AR = ActiveCell.Row AC = ActiveCell.Column Range(Cells(AR, AC), Cells(AR + 14, AC + 7)).Copy End Sub
__________________
Tom Urtis |
|
|
|
|
|
#3 |
|
MrExcel MVP
Moderator Join Date: May 2003
Location: Boulder Creek, CA
Posts: 18,775
|
How's this:
Sub SelectMe() ****With ActiveCell ********Range(ActiveCell, ActiveCell.Offset(14, 7)).Copy ****End With End Sub You'll need to add a copy to range, or you could add an InputBox to prompt for it. Hope that helps, Smitty |
|
|
|
|
|
#4 |
|
Join Date: Jun 2002
Location: North Carolina
Posts: 119
|
Both work great!!! Thanks very much!!!
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|