ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Amend range for negative value (https://www.excelbanter.com/excel-programming/307918-amend-range-negative-value.html)

gavmer[_66_]

Amend range for negative value
 
Hi all,

I have 2 questions i hope someone can help with.

1. My code copies and pastes based on value greater than 0. Problem is
i have a negative value i need to include. (IE -50). How can i do thi
and avoid copying all the blanks???

If IsNumeric(cell) Then
If cell 0 Then
Cells(cell.Row, 5).Copy
Sh.Cells(rw, "D").PasteSpecial Paste:=xlPasteValues
Cells(cell.Row, 2).Copy
Sh.Cells(rw, "b").PasteSpecial Paste:=xlPasteValues


2. values (prices) are inserted in a row however, i would not like th
user to see the pricing. They need to know a value is inserted bu
maybe only with a ##???? These values ditermine which data copies an
pastes so the above code needs to recognise a value??

Can anyone help??

Thanks in advance!!

--
Message posted from http://www.ExcelForum.com


Tom Ogilvy

Amend range for negative value
 
Perhaps

If IsNumeric(cell) Then
If cell.value < 0 and len(trim(cell.Text)) < 0 Then


If you do a custom cell format like "N";"N";; or "?";"?";; the value will
not display.


However, if the user selects the cell, the value will be visible in the
formula bar. To hide it in the formula bar, you can format the cell
(protection tab) as Hidden and then protect the sheet.

--
Regards,
Tom Ogilvy


"gavmer " wrote in message
...
Hi all,

I have 2 questions i hope someone can help with.

1. My code copies and pastes based on value greater than 0. Problem is,
i have a negative value i need to include. (IE -50). How can i do this
and avoid copying all the blanks???

If IsNumeric(cell) Then
If cell 0 Then
Cells(cell.Row, 5).Copy
Sh.Cells(rw, "D").PasteSpecial Paste:=xlPasteValues
Cells(cell.Row, 2).Copy
Sh.Cells(rw, "b").PasteSpecial Paste:=xlPasteValues


2. values (prices) are inserted in a row however, i would not like the
user to see the pricing. They need to know a value is inserted but
maybe only with a ##???? These values ditermine which data copies and
pastes so the above code needs to recognise a value??

Can anyone help??

Thanks in advance!!!


---
Message posted from http://www.ExcelForum.com/




gavmer[_67_]

Amend range for negative value
 
Tom,

As usual you are spot on. Thanks very much for your help!!!

Cheers!!

--
Message posted from http://www.ExcelForum.com



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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com