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: 25
Default Problem with Formula n VB Macro

Hi,

If I use

For i = 3 To iNumOfRows + 1
Sheet1.Cells(i, 6).Formula = Sheet1.Cells(2, 6).Formula
Next

It copies the formula for row 2:

"=SEARCH("_",C2,1)"

to all of these cell. Specifically I've got the following results:

Sheet1.Cells(3, 6).Formula = "=SEARCH("_",C2,1)"
Sheet1.Cells(4, 6).Formula = "=SEARCH("_",C2,1)"
Sheet1.Cells(5, 6).Formula = "=SEARCH("_",C2,1)"
Sheet1.Cells(6, 6).Formula = "=SEARCH("_",C2,1)"
....

That's NOT what I want. I want the row number in the formula the same
as the current cell.
Specifically, I want to get the following results:

Sheet1.Cells(3, 6).Formula = "=SEARCH("_",C3,1)"
Sheet1.Cells(4, 6).Formula = "=SEARCH("_",C4,1)"
Sheet1.Cells(5, 6).Formula = "=SEARCH("_",C5,1)"
Sheet1.Cells(6, 6).Formula = "=SEARCH("_",C6,1)"
....

Any advice on how to do this? Thanks!

-Emily

 
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
Formula Problem in Macro [email protected] Excel Discussion (Misc queries) 2 April 4th 07 09:49 PM
Put a formula to a cell with macro and it doesent calculate. (Excel localisation problem?) [email protected] Excel Programming 1 April 20th 06 02:39 PM
Problem in updating all worksheets of a workbook using a macro that calls another macro [email protected] Excel Programming 3 March 20th 06 05:21 AM
Macro Formula Updating Problem Tim Excel Programming 0 June 8th 04 05:16 PM
Excel/macro Formula Problem! nic17 Excel Programming 5 June 3rd 04 06:22 PM


All times are GMT +1. The time now is 12:18 AM.

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

About Us

"It's about Microsoft Excel"