LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 149
Default Insert Formula in Range

I'm trying to insert the formula shown in CODE 2 below into cells C3:C13.
C3:C13 is a named range that always will be constantly growing, so my
function
InsertFormula() in CODE 1 should handle the range expanding dilema.

My question is syntax with the formula. CODE 2 shows the formula needed in
C3. However, when my function loops to the C4 cell, the formula being
inserted needs to change from using A3 cell to the A4 cell, and so on until
the function fills my range will the formula.

Can someone help me modify my InsertFormula() function to insert the formula
in each cell while incrementing the relative cell reference?

CODE 1:

Sub InsertFormula()

Dim c As Range

Set c = ActiveSheet.Range("C3")

Do While c.Offset(0, -2).Value < ""
c.Value = xxxxxx ' Should be my formula
Set c = c.Offset(1, 0)
Loop

End Sub

CODE 2:

=IF(ISNA(VLOOKUP(A3,DataRange,1,FALSE)),"",A3)




 
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
Editing conditional formatting formula, arrow keys insert range. Bob Arnett Excel Discussion (Misc queries) 3 May 20th 09 12:56 AM
Macro to insert a formula based on a range MarcusA Excel Discussion (Misc queries) 1 December 8th 06 09:26 AM
Insert SUM Formula using VBA (Range Varies) William Horton Excel Programming 6 August 8th 05 03:18 PM
Macro to insert formula result into range with zero values in cell JPS Excel Programming 9 July 6th 05 05:56 AM
How to insert formula to a range of cells from VBA? crapit Excel Programming 10 March 18th 05 01:38 PM


All times are GMT +1. The time now is 05:36 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"