Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default creating a formula with a loop

is there an easier way to create a formula in cell than the following. i want to
show the individual amounts as a formula, don't want zero values, though.
ie =20+12+13+6

If IsEmpty(wsA.Range("J" & i)) And cell.Value 0 Then
wsA.Range("J" & i).Formula = "=" & wsA.Range("J" & i).Formula & "+" &
cell.Value
ElseIf cell.Value 0 Then
wsA.Range("J" & i).Formula = wsA.Range("J" & i).Formula & "+" &
cell.Value
End If

--


Gary



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default creating a formula with a loop

What you are doing already looks good.

Just be careful of having someing like
=5-2-3
in the cell. Because the result is zero, you will execute the elseif and
loose the "=" sign.
--
Gary''s Student - gsnu2007


"Gary Keramidas" wrote:

is there an easier way to create a formula in cell than the following. i want to
show the individual amounts as a formula, don't want zero values, though.
ie =20+12+13+6

If IsEmpty(wsA.Range("J" & i)) And cell.Value 0 Then
wsA.Range("J" & i).Formula = "=" & wsA.Range("J" & i).Formula & "+" &
cell.Value
ElseIf cell.Value 0 Then
wsA.Range("J" & i).Formula = wsA.Range("J" & i).Formula & "+" &
cell.Value
End If

--


Gary




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default creating a formula with a loop

ok, thanks. it will always be an addition in this case. the cell value is a
cumulative weight.

--


Gary


"Gary''s Student" wrote in message
...
What you are doing already looks good.

Just be careful of having someing like
=5-2-3
in the cell. Because the result is zero, you will execute the elseif and
loose the "=" sign.
--
Gary''s Student - gsnu2007


"Gary Keramidas" wrote:

is there an easier way to create a formula in cell than the following. i want
to
show the individual amounts as a formula, don't want zero values, though.
ie =20+12+13+6

If IsEmpty(wsA.Range("J" & i)) And cell.Value 0 Then
wsA.Range("J" & i).Formula = "=" & wsA.Range("J" & i).Formula & "+" &
cell.Value
ElseIf cell.Value 0 Then
wsA.Range("J" & i).Formula = wsA.Range("J" & i).Formula & "+" &
cell.Value
End If

--


Gary






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 creating Loop Jenny B. Excel Discussion (Misc queries) 3 February 14th 07 11:26 PM
Need Help With Creating A Loop zero635[_8_] Excel Programming 3 October 29th 05 08:58 PM
Creating a formula using the loop variable Spector[_2_] Excel Programming 1 October 22nd 04 10:10 PM
Creating a formula using the loop variable Spector Excel Programming 1 October 22nd 04 07:42 PM
Creating a For Loop Justin Ragsdale Excel Programming 5 May 23rd 04 10:40 PM


All times are GMT +1. The time now is 05:26 PM.

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"