Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Trouble Creating Formula in a Macro

Hello:

I am trying to creatre formulas in a macro. The sheet may have 1 to n
rows.
I am using the match formula to find the difference in two sheets.
The problem I am running into is how to increment the counter to put
the formula in when I don't know how many rows will be in the
spreadsheet to put the formula in.

=MATCH(C2,'Update'!$B$1:$B$65213,0)
C2 will change for each row, example C2, C3, C4, C5 etc.
It works fine if I put this into the spreadsheet.

Does anyone know how I can implement this into my code for each row
in
the spreadsheet?



Thank You,
Pamela

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 116
Default Trouble Creating Formula in a Macro

Hi Pam,

Range("A1:A" & Cells(Rows.Count, "D").End(xlUp).Row).FillDown

Change "A1:A" to the correct cell and column that the formula resides.
Change "D" to the column that you want to use as the data. This will fill
the formula to the last cell in the column chosen.

Regards,

Alan


"Pam" wrote in message
ups.com...
Hello:

I am trying to creatre formulas in a macro. The sheet may have 1 to n
rows.
I am using the match formula to find the difference in two sheets.
The problem I am running into is how to increment the counter to put
the formula in when I don't know how many rows will be in the
spreadsheet to put the formula in.

=MATCH(C2,'Update'!$B$1:$B$65213,0)
C2 will change for each row, example C2, C3, C4, C5 etc.
It works fine if I put this into the spreadsheet.

Does anyone know how I can implement this into my code for each row
in
the spreadsheet?



Thank You,
Pamela



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Trouble Creating Formula in a Macro

XL will automatically adjust the cell references if you create the
formulas at once:

Dim n As Long
n = 100
Range("C2").Resize(n, 1).Formula = _
"=MATCH(C2,'Update'!$B$1:$B$65213,0)"


In article . com,
"Pam" wrote:

Hello:

I am trying to creatre formulas in a macro. The sheet may have 1 to n
rows.
I am using the match formula to find the difference in two sheets.
The problem I am running into is how to increment the counter to put
the formula in when I don't know how many rows will be in the
spreadsheet to put the formula in.

=MATCH(C2,'Update'!$B$1:$B$65213,0)
C2 will change for each row, example C2, C3, C4, C5 etc.
It works fine if I put this into the spreadsheet.

Does anyone know how I can implement this into my code for each row
in
the spreadsheet?



Thank You,
Pamela

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
Trouble creating table lindyq Excel Discussion (Misc queries) 0 February 24th 10 04:54 PM
Trouble creating a chart jdh Excel Programming 2 February 6th 07 03:34 PM
Trouble creating DSN-less connection Red[_4_] Excel Programming 0 September 20th 05 02:53 PM
trouble w/ creating a VBA function that uses an enum in it's parameters [email protected] Excel Programming 2 August 2nd 05 12:54 PM
having trouble creating chart to show monthly totals Ian Roberts Charts and Charting in Excel 2 June 5th 05 06:36 PM


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