Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default macro to copy down formulas


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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default macro to copy down formulas

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default macro to copy down formulas


*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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default macro to copy down formulas

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default macro to copy down formulas


*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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Use Macro to Copy and paste formulas from one spreadsheet to anoth bevchapman Excel Discussion (Misc queries) 3 October 6th 09 05:50 PM
Macro to insert a row and copy down formulas from row above Sal Excel Discussion (Misc queries) 2 December 3rd 07 05:33 AM
Macro to automatically add rows and copy formulas Dave Excel Discussion (Misc queries) 0 June 6th 07 12:00 AM
How to copy the same formulas in a spreadsheet -Macro? klafert Excel Worksheet Functions 3 May 9th 07 10:10 PM
Macro to copy range of formulas to equal data lines lh Excel Worksheet Functions 2 August 15th 05 04:37 PM


All times are GMT +1. The time now is 08:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"