PC Review


Reply
Thread Tools Rate Thread

creating a formula with a loop

 
 
Gary Keramidas
Guest
Posts: n/a
 
      15th Sep 2007
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 With Quote
 
 
 
 
=?Utf-8?B?R2FyeScncyBTdHVkZW50?=
Guest
Posts: n/a
 
      15th Sep 2007
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 With Quote
 
Gary Keramidas
Guest
Posts: n/a
 
      15th Sep 2007
ok, thanks. it will always be an addition in this case. the cell value is a
cumulative weight.

--


Gary


"Gary''s Student" <(E-Mail Removed)> wrote in message
news:FCE2A182-DDC0-4886-BB3A-(E-Mail Removed)...
> 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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a loop JakeShipley2008 Microsoft Excel Misc 1 8th Sep 2008 10:26 PM
Need Help With Creating A Loop zero635 Microsoft Excel Programming 3 29th Oct 2005 08:58 PM
Creating a formula using the loop variable Spector Microsoft Excel Programming 1 22nd Oct 2004 10:10 PM
Creating a formula using the loop variable Spector Microsoft Excel Programming 1 22nd Oct 2004 07:42 PM
re:Help creating a loop. /2ez|n Microsoft VC .NET 0 9th Feb 2004 03:25 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:49 PM.