Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
When I write a macro to copy D1, it always copies D1. If I move to E1, I would like it to copy E1 (the cell I'm on). Does anyone know how to present this (cells and rows) as a variable in a macro? Thanks a bunch, Michele |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You could use ActiveCell, rather than a specific cell. That would copy
what cell currently has the focus. Or is there something else you meant by it? *** Sent via Developersdex http://www.developersdex.com *** |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Michele
Use ActiveCell ActiveCell.Copy Sheets("Sheet2").range("A1") Or Selection ? -- Regards Ron de Bruin http://www.rondebruin.nl wrote in message oups.com... Hi, When I write a macro to copy D1, it always copies D1. If I move to E1, I would like it to copy E1 (the cell I'm on). Does anyone know how to present this (cells and rows) as a variable in a macro? Thanks a bunch, Michele |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I tried your suggestion to use Active Cell, but now I get an error on
ActiveSheet.Paste. I'm basically, coping cell contents from one spreadsheet to another based on the row I'm in. Here's a few of the lines. Workbooks.Open Filename:= _ "C:\Documents and Settings\Administrator\My Documents\CustomSafety\010184641.xls" Range("A11:B11").Select Windows("Cust.xls").Activate ActiveCell.Copy Sheets("CustomerList").Range("A1") Windows("010184641.xls").Activate ActiveSheet.Paste Range("C11").Select Windows("Cust.xls").Activate Range("B6").Select Application.CutCopyMode = False Selection.Copy Windows("010184641.xls").Activate ActiveSheet.Paste Thanks for replying. Michele |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
The example line I posted will copy the activecell in sheet2 cell A1 ActiveCell.Copy Sheets("Sheet2").Range("A1") There is nothing on the clipboard now that's why you get the error Tell us exactly what you want to do and we can change the macro for you -- Regards Ron de Bruin http://www.rondebruin.nl wrote in message oups.com... I tried your suggestion to use Active Cell, but now I get an error on ActiveSheet.Paste. I'm basically, coping cell contents from one spreadsheet to another based on the row I'm in. Here's a few of the lines. Workbooks.Open Filename:= _ "C:\Documents and Settings\Administrator\My Documents\CustomSafety\010184641.xls" Range("A11:B11").Select Windows("Cust.xls").Activate ActiveCell.Copy Sheets("CustomerList").Range("A1") Windows("010184641.xls").Activate ActiveSheet.Paste Range("C11").Select Windows("Cust.xls").Activate Range("B6").Select Application.CutCopyMode = False Selection.Copy Windows("010184641.xls").Activate ActiveSheet.Paste Thanks for replying. Michele |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Run a macro in active cell only. Want to place current date/time. | Excel Worksheet Functions | |||
Macro to Insert Current Date into cell - Macro to "Save As" | Excel Worksheet Functions | |||
use current cell address as beginning of macro | Excel Discussion (Misc queries) | |||
Macro to run relative to current selected cell | Excel Discussion (Misc queries) | |||
Referncing the current cell name in an Excel MACRO | Excel Discussion (Misc queries) |