Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Problem concerning working with an uncertain # of rows

Hi all,

Based off a parameter query from a database, say I return the data to
an excel worksheet with columns 1 & 2 below. Because the output is
based off criteria, I don't know how many row entries there are for
the first two columns, and I need to make column 3. I'm going to to
need to do this multiple times for multiple queries, so I want to make
a VBA function to make entries in col 3 and stop at the last row. Any
suggestions?


(Col 1) (Col 2) (Col 3)
(row 1) 45 39 =(r1c1 + r1c2)
(row 2) 34 78 =(r1c1 + r2c2)
. . . .
. . . .
. . . .
? ? ? ?

Thanks much in advance,
Jim
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default Problem concerning working with an uncertain # of rows

Use this

x = Activesheet.Usedrange.rows.count

This will give u a count of all rows with data
Then you can use a for loo

for y = 2 to x
cells(x,3)= MyValue 'start at row 2, column 3(C
nex


----- Jim Lee wrote: ----

Hi all

Based off a parameter query from a database, say I return the data t
an excel worksheet with columns 1 & 2 below. Because the output i
based off criteria, I don't know how many row entries there are fo
the first two columns, and I need to make column 3. I'm going to t
need to do this multiple times for multiple queries, so I want to mak
a VBA function to make entries in col 3 and stop at the last row. An
suggestions


(Col 1) (Col 2) (Col 3
(row 1) 45 39 =(r1c1 + r1c2
(row 2) 34 78 =(r1c1 + r2c2
. . .
. . .
. . .
? ? ?

Thanks much in advance
Ji

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Problem concerning working with an uncertain # of rows

Jim

I don't work with RxCx refs so.....

With the formula =A1 + B1 in C1

Sub Auto_Fill()
Dim lrow As Long
With ActiveSheet
lrow = Range("A" & Rows.Count).End(xlUp).Row
Range("C1:C" & lrow).FillDown
End With
End Sub

Gord Dibben Excel MVP

On 16 Apr 2004 09:28:53 -0700, (Jim Lee) wrote:

Hi all,

Based off a parameter query from a database, say I return the data to
an excel worksheet with columns 1 & 2 below. Because the output is
based off criteria, I don't know how many row entries there are for
the first two columns, and I need to make column 3. I'm going to to
need to do this multiple times for multiple queries, so I want to make
a VBA function to make entries in col 3 and stop at the last row. Any
suggestions?


(Col 1) (Col 2) (Col 3)
(row 1) 45 39 =(r1c1 + r1c2)
(row 2) 34 78 =(r1c1 + r2c2)
. . . .
. . . .
. . . .
? ? ? ?

Thanks much in advance,
Jim


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
Excel macro to insert uncertain numbers of column with different value [email protected] Excel Discussion (Misc queries) 2 March 7th 07 10:12 PM
Problem with functions working erajim New Users to Excel 2 January 5th 07 03:11 AM
Adding Rows offsets to working rows across two worksheets tom Setting up and Configuration of Excel 3 July 30th 06 07:54 PM
Help!! I have problem deleting 2500 rows of filtered rows!!!! shirley_kee Excel Discussion (Misc queries) 1 January 12th 06 03:24 AM
Returning a Value to a Cell Based on a Range of Uncertain Size amc422 Excel Worksheet Functions 7 November 14th 04 03:03 PM


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