Loop through range, evaluate value, convert to fractional #

DougStroud

Well-known Member
Joined
Aug 16, 2005
Messages
2,968
Working on line of code that will evaluate for a value and make changes w/ code.

Loop through the Range F4:F.

If in the range of F4:F the value "Hat" or "Shoe" is present, Then
offset to column "M" and test if the corresponding value is numeric, if it is and if it is a decimal value, convert to a fractional value.

Example:
F887 = "Hat"
M887 = "7.25"
Convert M887 to "7 1/4" (without quotes)

Here is where I am;
Code:
For Each c In Range("F4:F" & LRow)
if c.Value="Hat" & c.offset(isnumeric(0,7)) and if c.value/1 <>1 then


Thanks,

Doug
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
I am cobbling this together-
I have the loop finding the first value "Hat" and does the formula portion of the procedure.
I need to add a second If statement to determine if it is Numeric.
My code is failing on the second If

Code:
For i = 1 To LRow
        If Cells(i, "F") = "Hat" if cells(isnumeric(i,"m")Then
        Cells(i, "M").Value = Cells(i, "M") / 2
       End If
    Next i
 
Upvote 0

Forum statistics

Threads
1,214,409
Messages
6,119,339
Members
448,888
Latest member
Arle8907

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