Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default Adding to rows - sign issue??

Hi

I'm adding two rows with

with ActiveSheet
Range("D12").formula ="B12+C12"
Lrow = Range("C" & Rows.count).end(xlup).row
Range("D12:D" & 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Adding to rows - sign issue??

with ActiveSheet
Range("D12").formula ="=B12+C12" ' add an equal sign
Lrow = Range("C" & Rows.count).end(xlup).row
Range("D12:D" & 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:D" & 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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default Adding to rows - sign issue??

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:D" & 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:D" & 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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Adding to rows - sign issue??

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:D" & 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:D" & 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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default Adding to rows - sign issue??

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:D" & 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:D" & 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
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
= sign in formula changes to + when adding a cell or name Steve Excel Discussion (Misc queries) 2 May 19th 09 04:02 PM
Automatic adding in a single cell w/o equal sign jacky Excel Worksheet Functions 10 March 30th 09 12:49 PM
Rounding to integers and adding plus sign Joe Excel Discussion (Misc queries) 4 May 24th 08 02:11 AM
Adding - sign(-) harvindersingh1 Excel Programming 2 April 4th 06 05:34 AM
Equal Sign Issue Jedidia Excel Worksheet Functions 2 June 28th 05 04:13 AM


All times are GMT +1. The time now is 07:01 AM.

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"