PC Review


Reply
Thread Tools Rate Thread

Adding to rows - sign issue??

 
 
=?Utf-8?B?QmFyYg==?=
Guest
Posts: n/a
 
      15th Jun 2007
Hi

I'm adding two rows with

with ActiveSheet
Range("D12").formula ="B12+C12"
Lrow = Range("C" & Rows.count).end(xlup).row
Range("D12" & Lrow).filldown
End With

it doesn't work when I have a negatif value. It's adding like if it was a
positif value. I changed the category of the row to number but when I'm
running that macro then it sends back the category to General. I'm biginning
in excel can you tell me what to do ?

My second question is when I have to add a $ in my macro like example
($A1:$B1)? Do you have a web site where I can learn about it?

Thanks
Jack
 
Reply With Quote
 
 
 
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      15th Jun 2007
with ActiveSheet
Range("D12").formula ="=B12+C12" ' add an equal sign
Lrow = Range("C" & Rows.count).end(xlup).row
Range("D12" & Lrow).filldown
End With

for building a formula that uses $,
In Excel help, look at absolute and relative references.

As an argument to the Range object, you never need to use $.

--
Regards,
Tom Ogilvy

"Barb" wrote:

> Hi
>
> I'm adding two rows with
>
> with ActiveSheet
> Range("D12").formula ="B12+C12"
> Lrow = Range("C" & Rows.count).end(xlup).row
> Range("D12" & Lrow).filldown
> End With
>
> it doesn't work when I have a negatif value. It's adding like if it was a
> positif value. I changed the category of the row to number but when I'm
> running that macro then it sends back the category to General. I'm biginning
> in excel can you tell me what to do ?
>
> My second question is when I have to add a $ in my macro like example
> ($A1:$B1)? Do you have a web site where I can learn about it?
>
> Thanks
> Jack

 
Reply With Quote
 
=?Utf-8?B?QmFyYg==?=
Guest
Posts: n/a
 
      15th Jun 2007
Thanks Tom,
It works but only for positive values. If I have -555+3 the value will be
558 instead of -552. Do you know what I have to do to keep the row in integer
instead of general category?

"Tom Ogilvy" wrote:

> with ActiveSheet
> Range("D12").formula ="=B12+C12" ' add an equal sign
> Lrow = Range("C" & Rows.count).end(xlup).row
> Range("D12" & Lrow).filldown
> End With
>
> for building a formula that uses $,
> In Excel help, look at absolute and relative references.
>
> As an argument to the Range object, you never need to use $.
>
> --
> Regards,
> Tom Ogilvy
>
> "Barb" wrote:
>
> > Hi
> >
> > I'm adding two rows with
> >
> > with ActiveSheet
> > Range("D12").formula ="B12+C12"
> > Lrow = Range("C" & Rows.count).end(xlup).row
> > Range("D12" & Lrow).filldown
> > End With
> >
> > it doesn't work when I have a negatif value. It's adding like if it was a
> > positif value. I changed the category of the row to number but when I'm
> > running that macro then it sends back the category to General. I'm biginning
> > in excel can you tell me what to do ?
> >
> > My second question is when I have to add a $ in my macro like example
> > ($A1:$B1)? Do you have a web site where I can learn about it?
> >
> > Thanks
> > Jack

 
Reply With Quote
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      15th Jun 2007
B12: -555
C12: 3

Range("D12").formula ="=B12+C12"

gave me -552 in D12

format the cell to display an integer.

If you want it to actually hold an integer then change the formula to


Range("D12").formula ="=Round(B12+C12,0)"

or

Range("D12").Formula ="=Trunc(B12+C12,0)"

depending on what you want.

--
Regards,
Tom Ogilvy



"Barb" wrote:

> Thanks Tom,
> It works but only for positive values. If I have -555+3 the value will be
> 558 instead of -552. Do you know what I have to do to keep the row in integer
> instead of general category?
>
> "Tom Ogilvy" wrote:
>
> > with ActiveSheet
> > Range("D12").formula ="=B12+C12" ' add an equal sign
> > Lrow = Range("C" & Rows.count).end(xlup).row
> > Range("D12" & Lrow).filldown
> > End With
> >
> > for building a formula that uses $,
> > In Excel help, look at absolute and relative references.
> >
> > As an argument to the Range object, you never need to use $.
> >
> > --
> > Regards,
> > Tom Ogilvy
> >
> > "Barb" wrote:
> >
> > > Hi
> > >
> > > I'm adding two rows with
> > >
> > > with ActiveSheet
> > > Range("D12").formula ="B12+C12"
> > > Lrow = Range("C" & Rows.count).end(xlup).row
> > > Range("D12" & Lrow).filldown
> > > End With
> > >
> > > it doesn't work when I have a negatif value. It's adding like if it was a
> > > positif value. I changed the category of the row to number but when I'm
> > > running that macro then it sends back the category to General. I'm biginning
> > > in excel can you tell me what to do ?
> > >
> > > My second question is when I have to add a $ in my macro like example
> > > ($A1:$B1)? Do you have a web site where I can learn about it?
> > >
> > > Thanks
> > > Jack

 
Reply With Quote
 
=?Utf-8?B?QmFyYg==?=
Guest
Posts: n/a
 
      15th Jun 2007
Thanks Tom, it works!

"Tom Ogilvy" wrote:

> B12: -555
> C12: 3
>
> Range("D12").formula ="=B12+C12"
>
> gave me -552 in D12
>
> format the cell to display an integer.
>
> If you want it to actually hold an integer then change the formula to
>
>
> Range("D12").formula ="=Round(B12+C12,0)"
>
> or
>
> Range("D12").Formula ="=Trunc(B12+C12,0)"
>
> depending on what you want.
>
> --
> Regards,
> Tom Ogilvy
>
>
>
> "Barb" wrote:
>
> > Thanks Tom,
> > It works but only for positive values. If I have -555+3 the value will be
> > 558 instead of -552. Do you know what I have to do to keep the row in integer
> > instead of general category?
> >
> > "Tom Ogilvy" wrote:
> >
> > > with ActiveSheet
> > > Range("D12").formula ="=B12+C12" ' add an equal sign
> > > Lrow = Range("C" & Rows.count).end(xlup).row
> > > Range("D12" & Lrow).filldown
> > > End With
> > >
> > > for building a formula that uses $,
> > > In Excel help, look at absolute and relative references.
> > >
> > > As an argument to the Range object, you never need to use $.
> > >
> > > --
> > > Regards,
> > > Tom Ogilvy
> > >
> > > "Barb" wrote:
> > >
> > > > Hi
> > > >
> > > > I'm adding two rows with
> > > >
> > > > with ActiveSheet
> > > > Range("D12").formula ="B12+C12"
> > > > Lrow = Range("C" & Rows.count).end(xlup).row
> > > > Range("D12" & Lrow).filldown
> > > > End With
> > > >
> > > > it doesn't work when I have a negatif value. It's adding like if it was a
> > > > positif value. I changed the category of the row to number but when I'm
> > > > running that macro then it sends back the category to General. I'm biginning
> > > > in excel can you tell me what to do ?
> > > >
> > > > My second question is when I have to add a $ in my macro like example
> > > > ($A1:$B1)? Do you have a web site where I can learn about it?
> > > >
> > > > Thanks
> > > > Jack

 
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
Add an inches sign to many rows Denise Microsoft Excel Misc 5 4th Feb 2010 10:55 PM
How do I hide rows by using the + sign? =?Utf-8?B?Y3JhenlAd29yaw==?= Microsoft Excel Misc 2 8th Nov 2007 04:59 PM
Adding rows to a data table: Rows do not show up =?Utf-8?B?dnZlbms=?= Microsoft VB .NET 2 10th Oct 2006 12:07 AM
Repost:Adding rows to DataTable and DataView issue Marina Microsoft ADO .NET 1 2nd May 2005 06:34 PM
Adding rows to DataTable and DataView issue Marina Microsoft ADO .NET 1 28th Apr 2005 06:14 PM


Features
 

Advertising
 

Newsgroups
 


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