vba code help needed for decimal values

vranjit138

Board Regular
Joined
Dec 18, 2006
Messages
146
Office Version
  1. 365
Platform
  1. Windows
Hi Geeks,
I have a peculiar scenario .. i have list of values in column a and b from for rows 1 to 20 . Range from A1 to B20 shows values as 0.00 in the cells but these are actually decimal values like in cell A1 = 0.000003456 and B1 = 0.000002345. I want to write a vba code so that i can put in column C as true or false based on the values in col A and B. I need the vba code so that i can use it as a part of a logic in a module.
Please help with the vba code. I tried to declare variables as double and ran a for loop but did not get the intended result.
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
You need to be more specific.

cell A1 = 0.000003456 and B1 = 0.000002345 , in this case do you want C1 to show as True or False? True meaning they are considered the same when rounded to 2 decimals. False meaning the full value must be used for comparison (this is the default behavior).
 
Upvote 0
Then probably something like this:
VBA Code:
    Dim i As Long
    For i = 1 To 20
        ActiveSheet.Cells(i, "c").Value = ActiveSheet.Cells(i, "a").Value = ActiveSheet.Cells(i, "b").Value
    Next
 
Upvote 0

Forum statistics

Threads
1,215,326
Messages
6,124,267
Members
449,149
Latest member
mwdbActuary

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