LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #12   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,081
Default Rows added after refresh not in formula

these 2 lines of code find the last row of data in column C (just guessing
that this was one of the columns populated by SQL - if not, change the column
letter), assigning the row number to the variable lrow

dim lrow as long
lrow = Range("c65256").End(xlUp).Row

If you change this code (which places your F6*$G$5 formula in every row of
column A from row 6 to the last row of data in column C)

Range("a6", "a" & lrow).FormulaR1C1 = "= rc6*r5c7"

to

Range("G6", "G" & lrow).FormulaR1C1 = "= rc6*r5c7"

It will put the formula in col G.

Is there a possibility of rows coming back from SQL with a null value in A,
and then you don't want the formula to appear in column G? Then use

Range("G6", "G" & lrow).FormulaR1C1 = "= if(rc1="","",rc6*r5c7)"


"Greg Snidow" wrote:

Thanks Duke, but I am confused. Are you saying that something would be
populated in column A? This is not what I need. Column A is a job# that
comes from the SQL view. What I need is for the formulas in certain columns,
G, in my example to exist in all rows in column G where there is a job# in A.
If that is what you are trying to tell me I do not understand. Does any of
this make sense? If not let me know, as I do not know the lingo you all use
to get my point across.



"Duke Carey" wrote:

Well, to address your question about copying the formula in a macro, you can
determine the last row of data by doing something like this

dim lrow as long
lrow = Range("c65256").End(xlUp).Row

and then this will populate column A, starting in row 6, with the =F6*$G$5
formula

Range("a6", "a" & lrow).FormulaR1C1 = "= rc6*r5c7"



 
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
resetting last cell jagdish.eashwar Excel Discussion (Misc queries) 11 March 31st 06 02:06 AM
Match then lookup Tenacity Excel Worksheet Functions 9 December 3rd 05 05:30 AM
Formula checking multiple worksheets sonic-the-mouse Excel Worksheet Functions 2 June 5th 05 07:48 PM
Formula checking multiple worksheets sonic-the-mouse Excel Worksheet Functions 2 June 5th 05 03:28 AM
Insert rows, keep a formula? tb Excel Worksheet Functions 1 April 23rd 05 03:41 PM


All times are GMT +1. The time now is 04:57 AM.

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"