Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I need a macro to copy down formulas. The expected macro should do the following: Ex: I select the cells with the formulas and call the macro 1- Asks (input) for the "final cells", I write ex J:14000;H1400 (the next time i call the macro should give by default the last one incerted.) 2- Copy automatically the formula until the "final cells". If someone can help me, please do Thanks : -- pmarque ----------------------------------------------------------------------- pmarques's Profile: http://www.excelforum.com/member.php...fo&userid=2511 View this thread: http://www.excelforum.com/showthread.php?threadid=51613 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
pmarques,
Try the macro below. HTH, Bernie MS Excel MVP Option Explicit Dim myLastCell As Range Sub TryNow() If Not ActiveCell.HasFormula Then MsgBox "You must select a cell(s) with a formula" _ & Chr(10) & "prior to running this macro." Exit Sub End If If myLastCell Is Nothing Then Set myLastCell = Application.InputBox("Last Cell?", _ Default:=ActiveCell.Address, Type:=8) Else Set myLastCell = Application.InputBox("Last Cell?", _ Default:=myLastCell.Address, Type:=8) End If Selection.Copy Range(Selection, myLastCell) End Sub "pmarques" wrote in message ... I need a macro to copy down formulas. The expected macro should do the following: Ex: I select the cells with the formulas and call the macro 1- Asks (input) for the "final cells", I write ex J:14000;H14000 (the next time i call the macro should give by default the last ones incerted.) 2- Copy automatically the formula until the "final cells". If someone can help me, please do Thanks :) -- pmarques ------------------------------------------------------------------------ pmarques's Profile: http://www.excelforum.com/member.php...o&userid=25110 View this thread: http://www.excelforum.com/showthread...hreadid=516130 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() *Very good! Just one thing, it´s working with one single columm, it's possible to use de macro to work for example with two adjacent collums selected (with diferent formulas) Thanks a lot :) :)*---------------------------------------------------------------------- Bernie Deitrick Wrote: pmarques, Try the macro below. HTH, Bernie MS Excel MVP Option Explicit Dim myLastCell As Range Sub TryNow() If Not ActiveCell.HasFormula Then MsgBox "You must select a cell(s) with a formula" _ & Chr(10) & "prior to running this macro." Exit Sub End If If myLastCell Is Nothing Then Set myLastCell = Application.InputBox("Last Cell?", _ Default:=ActiveCell.Address, Type:=8) Else Set myLastCell = Application.InputBox("Last Cell?", _ Default:=myLastCell.Address, Type:=8) End If Selection.Copy Range(Selection, myLastCell) End Sub -- pmarques ------------------------------------------------------------------------ pmarques's Profile: http://www.excelforum.com/member.php...o&userid=25110 View this thread: http://www.excelforum.com/showthread...hreadid=516130 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
pmarques,
It will work for multiple columns as written. Just select your two (or three or eight) cells with formulas, then select your end cell appropriately, at the bottom of the second (or third or eighth) column. HTH, Bernie MS Excel MVP "pmarques" wrote in message ... *Very good! Just one thing, it´s working with one single columm, it's possible to use de macro to work for example with two adjacent collums selected (with diferent formulas) Thanks a lot :) :)*---------------------------------------------------------------------- Bernie Deitrick Wrote: pmarques, Try the macro below. HTH, Bernie MS Excel MVP Option Explicit Dim myLastCell As Range Sub TryNow() If Not ActiveCell.HasFormula Then MsgBox "You must select a cell(s) with a formula" _ & Chr(10) & "prior to running this macro." Exit Sub End If If myLastCell Is Nothing Then Set myLastCell = Application.InputBox("Last Cell?", _ Default:=ActiveCell.Address, Type:=8) Else Set myLastCell = Application.InputBox("Last Cell?", _ Default:=myLastCell.Address, Type:=8) End If Selection.Copy Range(Selection, myLastCell) End Sub -- pmarques ------------------------------------------------------------------------ pmarques's Profile: http://www.excelforum.com/member.php...o&userid=25110 View this thread: http://www.excelforum.com/showthread...hreadid=516130 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() *Hi Bernie Deitrick Sorry for the delay You are correct, It works for multiple columns. It's a very useful macro, i recommend :) Thanks a lot :) :) :)* -- pmarques ------------------------------------------------------------------------ pmarques's Profile: http://www.excelforum.com/member.php...o&userid=25110 View this thread: http://www.excelforum.com/showthread...hreadid=516130 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Use Macro to Copy and paste formulas from one spreadsheet to anoth | Excel Discussion (Misc queries) | |||
Macro to insert a row and copy down formulas from row above | Excel Discussion (Misc queries) | |||
Macro to automatically add rows and copy formulas | Excel Discussion (Misc queries) | |||
How to copy the same formulas in a spreadsheet -Macro? | Excel Worksheet Functions | |||
Macro to copy range of formulas to equal data lines | Excel Worksheet Functions |