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

hi all!

i have a cell with a formula in it
ie cell C1
=sumif(a1:a10,"B",B1:B10)

this formula is written with vba code

how can i reference this cell using
cells(rowNum,colNum) - and update it to be

=sumif(a1:a10,"B",B1:B10)+1

i want to be able to do something similar to
cells(rowNum,colNum)=cells(rowNum,colNum)+1
but with the resulting formula above

(hope this makes sense!)

J
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,089
Default cell formula manipulation

J

one way:

Range("C1").Formula = Range("C1").Formula & "+1"

Regards

Trevor


"Gixxer_J_97" wrote in message
...
hi all!

i have a cell with a formula in it
ie cell C1
=sumif(a1:a10,"B",B1:B10)

this formula is written with vba code

how can i reference this cell using
cells(rowNum,colNum) - and update it to be

=sumif(a1:a10,"B",B1:B10)+1

i want to be able to do something similar to
cells(rowNum,colNum)=cells(rowNum,colNum)+1
but with the resulting formula above

(hope this makes sense!)

J



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default cell formula manipulation

Perhaps,

rowStart = 1
rowEnd = 10
colStart = 1
colEnd = 2

Range("C1").FormulaR1C1 = "=SUMIF(R" & rowStart & "C" & colStart & _
":R" & rowEnd & "C" & colStart & _
",""B"",R" & rowStart & "C" & colEnd & _
":R" & rowEnd & "C" & colEnd & ")"

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Gixxer_J_97" wrote in message
...
hi all!

i have a cell with a formula in it
ie cell C1
=sumif(a1:a10,"B",B1:B10)

this formula is written with vba code

how can i reference this cell using
cells(rowNum,colNum) - and update it to be

=sumif(a1:a10,"B",B1:B10)+1

i want to be able to do something similar to
cells(rowNum,colNum)=cells(rowNum,colNum)+1
but with the resulting formula above

(hope this makes sense!)

J




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 206
Default cell formula manipulation

Thanks to both!

Trevor's was the way i was looking for!

In reality my formula is much much more complicated than the one i used.

J

"Bob Phillips" wrote:

Perhaps,

rowStart = 1
rowEnd = 10
colStart = 1
colEnd = 2

Range("C1").FormulaR1C1 = "=SUMIF(R" & rowStart & "C" & colStart & _
":R" & rowEnd & "C" & colStart & _
",""B"",R" & rowStart & "C" & colEnd & _
":R" & rowEnd & "C" & colEnd & ")"

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Gixxer_J_97" wrote in message
...
hi all!

i have a cell with a formula in it
ie cell C1
=sumif(a1:a10,"B",B1:B10)

this formula is written with vba code

how can i reference this cell using
cells(rowNum,colNum) - and update it to be

=sumif(a1:a10,"B",B1:B10)+1

i want to be able to do something similar to
cells(rowNum,colNum)=cells(rowNum,colNum)+1
but with the resulting formula above

(hope this makes sense!)

J





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
Need Help with Cell Manipulation gm Excel Discussion (Misc queries) 2 January 21st 06 10:11 AM
Help w/ Cell Manipulation gm Excel Worksheet Functions 0 January 21st 06 02:38 AM
Cell manipulation John F[_2_] Excel Programming 2 October 27th 04 02:17 PM
Cell Manipulation Cr4z3 Excel Programming 5 September 30th 04 07:32 AM
Cell Manipulation Cr4z3[_2_] Excel Programming 1 September 30th 04 05:57 AM


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