Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default changing cell formula part of macro


Hello. I have a program with a simple macro I am trying to make. Here
is the macro right now, it works fine as is: (I have highlighted in
bold what I would like to change)

Sub RequiredDate()
Dim rizange, rizaange, a_range, b_range, As Range
Set rizange = Range("H2:H8")
Set rizaange = Range("I2:I8")
For Each a_range In rizange
If a_range < "" Then
Range("j" & a_range.Row).Select
ActiveCell.Formula = "*=E2+10*"
End If
Next

For Each b_range In rizaange
If b_range < "" Then
Range("j" & b_range.Row).Select
ActiveCell.Formula = "*=E2+15*"
End If
Next
End Sub


I would like to change the cell formula part of the macro. Instead of
all of them being E2 plus a number, I would like it to be E2, then E3,
then E4, etc etc. But when I try to replace what I have with something
like:
="("e" & b_range.Row)+15" it gives me an error. Is there a way that I
can fix this?

Thanks for your help.

-Steve


--
thephoenix12
------------------------------------------------------------------------
thephoenix12's Profile: http://www.excelforum.com/member.php...o&userid=24336
View this thread: http://www.excelforum.com/showthread...hreadid=395460

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default changing cell formula part of macro


I think this will get you started....

Sub RequiredDate()

Dim rizange, rizaange, a_range, b_range As Range
Dim Count As Integer

Set rizange = Range("H2:H8")

Count = 2
For Each a_range In rizange
If a_range < "" Then
Range("j" & a_range.Row).Select
ActiveCell.Formula = "=E" & Count & "+10"
Count = Count + 1
End If
Next

End Sub


--
mthomas
------------------------------------------------------------------------
mthomas's Profile: http://www.excelforum.com/member.php...o&userid=25649
View this thread: http://www.excelforum.com/showthread...hreadid=395460

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
Changing part of cell reference in INDEX - MATCH formula HebbeLille Excel Worksheet Functions 7 August 6th 09 02:53 PM
Using a changing cell reference as part of a workbook name 2 link Jason Excel Discussion (Misc queries) 2 June 12th 09 04:24 PM
changing name of a sheet that's part of a formula [email protected] Excel Discussion (Misc queries) 2 October 3rd 08 02:56 PM
Changing part of a formula Hankjam[_2_] Excel Discussion (Misc queries) 1 March 15th 08 05:30 PM
Changing font of part of text in a cell Ross Withey Excel Programming 4 November 11th 03 02:09 AM


All times are GMT +1. The time now is 09:31 PM.

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"