Entering a text in a cell based on another cell value

Basemraven

New Member
Joined
Jan 19, 2022
Messages
12
Office Version
  1. 365
Platform
  1. Windows
i use a simple (if) line to add a text to a cretin cell based on a cell value
but the problem is all 0,## values (0,01/0,02/-0,01.......) considered as 0 and not as above 0
the code i use is

VBA Code:
If com = 0 Then Range("A" & LastRow + 1) = "Summe:"
If com <= 5 And com > 0 Then Range("A" & LastRow + 1) = "Ausbuchen"
If com < 0 And com >= -5 Then Range("A" & LastRow + 1) = "Ausbuchen"
If com >= 15 Or com <= -15 Then Range("A" & LastRow + 1) = "Stehen lassen"

in case of 0 then text1
between (-5 , 5 ) text2
above than -15 or +15 text3
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
How is "com" defined in your code?
Have you declared it to be "Long" or "Integer"?

If so, those are whole numbers and drop all decimals.
You will want to declare it as "Single" or "Double".
 
Upvote 0
Solution
How is "com" defined in your code?
Have you declared it to be "Long" or "Integer"?

If so, those are whole numbers and drop all decimals.
You will want to declare it as "Single" or "Double".
Thank man!
i tried so many things except that ?
 
Upvote 0
You are welcome.
 
Upvote 0

Forum statistics

Threads
1,214,589
Messages
6,120,415
Members
448,960
Latest member
AKSMITH

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top