Loop through range, evaluate value, convert to fractional #

DougStroud

Well-known Member
Joined
Aug 16, 2005
Messages
2,976
Office Version
  1. 365
Platform
  1. MacOS
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 shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
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,222,244
Messages
6,164,792
Members
451,917
Latest member
WEB78

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