formula only works validating if cell type is general.0

dutchdog

New Member
Joined
May 6, 2011
Messages
10
My VB formula only validates if the celltype is set to general.

As soon as I make it % the formula doesnt work.

Any clues why?

so can hide row if celldata is 100

but not when the celldata is 100%
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Code:
If Worksheets("Accomplishments").Range("J5").Value < 100 Then
     Worksheets("Accomplishments").Rows("5:8").EntireRow.Hidden = True
    Worksheets("Actionplan").Rows("6:7").EntireRow.Hidden = True
    Worksheets("Oppurtunities").Rows("5:8").EntireRow.Hidden = False
    Else
    End If

it works when cell is set to 'general' but not with percentage

thanks
 
Upvote 0
It has nothing to do with the cell format, it has to do with your logic. 100% is less than 100 ( percentage is a fraction of 1, so 50% is numerically 0.5, and 100% is 1.0 ), and your logic is for hiding rows is when J5 is less than 100. All percentages less than 10,000% will therefore be processed by your code.
 
Upvote 0

Forum statistics

Threads
1,224,599
Messages
6,179,828
Members
452,946
Latest member
JoseDavid

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