Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default store formula in macro then paste it when macro runs

I download a file every month and I need to format it adding columns,
deleting rows, etc - also I need to add some formulas to the file so that the
data is formatted according to my specifications and to be used in another
model.

The formula is to be pasted on cell B3 ... and the formula is
=RIGHT(LEFT(A3,16),3).

Thanks


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 489
Default store formula in macro then paste it when macro runs

Is this what you need?

Sub PasteFormula()

Range("B3").Formula = "=RIGHT(LEFT(A3,16),3)"

End Sub
--
Cheers,
Ryan


"Nina" wrote:

I download a file every month and I need to format it adding columns,
deleting rows, etc - also I need to add some formulas to the file so that the
data is formatted according to my specifications and to be used in another
model.

The formula is to be pasted on cell B3 ... and the formula is
=RIGHT(LEFT(A3,16),3).

Thanks


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default store formula in macro then paste it when macro runs


Nina;588766 Wrote:
I download a file every month and I need to format it adding columns,
deleting rows, etc - also I need to add some formulas to the file so
that the
data is formatted according to my specifications and to be used in
another
model.

The formula is to be pasted on cell B3 ... and the formula is
=RIGHT(LEFT(A3,16),3).

Thanks



Code:
--------------------
range("B3").Formula="=RIGHT(LEFT(A3,16),3)"

--------------------
or shorter:

Code:
--------------------
range("B3").Formula="=MID(A3,14,3)"
--------------------


--
p45cal

*p45cal*
------------------------------------------------------------------------
p45cal's Profile: 558
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=163085

Microsoft Office Help

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default store formula in macro then paste it when macro runs

Would this formula pasted into B3 have to copied down as far as you have
data in Column A?

Sub Auto_Fill()
Dim lRow As Long
With ActiveSheet
Range("B3").Formula = "=MID(A3,14,3)" 'using p45cal's version
lRow = .Range("A" & Rows.Count).End(xlUp).Row
.Range("B3:B" & lRow).FillDown
End With
End Sub


Gord Dibben MS Excel MVP

On Wed, 16 Dec 2009 10:22:01 -0800, Nina
wrote:

I download a file every month and I need to format it adding columns,
deleting rows, etc - also I need to add some formulas to the file so that the
data is formatted according to my specifications and to be used in another
model.

The formula is to be pasted on cell B3 ... and the formula is
=RIGHT(LEFT(A3,16),3).

Thanks


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
VBA macro runs fine, but freezes if I try to do ANYTHING else whileit runs Rruffpaw Setting up and Configuration of Excel 1 September 17th 11 01:25 PM
Once formula runs how to store result permenantly workingatit Excel Worksheet Functions 1 October 13th 08 07:39 PM
Macro runs upon wkbk open, but no Workbook_Open or Auto_Open Macro Ron Coderre Excel Programming 2 September 26th 06 05:50 PM
One macro runs then it auto runs another macro PG Excel Discussion (Misc queries) 2 September 1st 06 09:30 PM
Formula defines range or runs macro Mike[_52_] Excel Programming 1 September 26th 03 07:17 PM


All times are GMT +1. The time now is 04:05 PM.

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

About Us

"It's about Microsoft Excel"