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

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
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
great stuff..

so 53% is 0.53 :rolleyes:

OK.. thats what I needed to know to validate percentages.

Thanks man.
 
Upvote 0

Forum statistics

Threads
1,213,497
Messages
6,113,998
Members
448,539
Latest member
alex78

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