Two Plus Two Newer Archives

Two Plus Two Newer Archives (http://archives1.twoplustwo.com/index.php)
-   Computer Technical Help (http://archives1.twoplustwo.com/forumdisplay.php?f=50)
-   -   Excel VBA Help (http://archives1.twoplustwo.com/showthread.php?t=479717)

Zobags 08-17-2007 06:16 AM

Excel VBA Help
 
I am building a big spreadsheet in excel, and I was wondering if I could create a macro that moves the Active Cell one cell down and one cell to the right. Does anyone know if this is possible or how to do it? Any help would be greatly appreciated. Also, recommendations to any other forums where I might find the answer would be appreciated.

kerowo 08-17-2007 07:27 AM

Re: Excel VBA Help
 
If you want all the other cells to move as well:
Record a macro
select a cell
insert a cell above it moving it down
insert a cell to the right of it moving the cells to the left
stop the macro

If you want to cut and paste overwriting the contents of the target but not moving other cells:
Record a macro
select a cell
cut
paste in target
stop the macro

You may have to edit the last macro to generalize the target cell from source cell, but it should just be a matter of taking the active cell and adding one to the row and column.

nuclear500 08-17-2007 10:17 AM

Re: Excel VBA Help
 
As the other poster said, learning how to create macros is as simple as just recording one and then looking at the code.

As someone who has done programmatic access (via vbscripts or apps) to Word and Excel I cannot tell you how easy it was to do fancy junk by just ganking the code after recording the macro.

Zobags 08-17-2007 04:20 PM

Re: Excel VBA Help
 
I tried recording first, but it didn't work because it records the absolute position of the cell rather than the relative one. For example, if I start at A1 and move to B2 the recorded macro just says Range("B2").select. Someone on the software forum gave me the solution, but thank you anyway for your help.


All times are GMT -4. The time now is 03:00 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.