vba IsNumeric? Cell with only numerical value

EMcK01

Board Regular
Joined
Jun 14, 2015
Messages
125
Hi,

I'm trying to search a range and do an offset based on the cell value having a numerical value only.

I've tried to use IsNumeric to find a cell with not text and use it to copy offset with the following code.
VBA Code:
      Set rngB = Range("B3:B1000")
              For Each cell In rngB

              If IsNumeric(rngB) = True Then
              
                cell.Copy cell.Offset(-1, 9)
                cell.Offset(-1).Copy cell.Offset(-1, 6)
                cell.Offset(1).Copy cell.Offset(-1, 8)
    
            End If
            
        Next cell

I don't think I'm using the
VBA Code:
If IsNumeric(rngB) = True Then
argument correctly but not sure exactly how to change this.

For info, the cells I'm trying to base this on is a time value that is formatted to hh:mm if that makes any difference. I also have other cells in the range that have strings with a mixture of letters and numbers so assumed IsNumeric was the best way to skip over this.

Any assistance would be appreciated.

Thanks,
Ewan
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
You picked the wrong range object.
It should be:
VBA Code:
If IsNumeric(cell) Then
btw, you do not need "= True" with boolean functions like IsNumeric. It is redundant and unnecessary.
 
Upvote 0
It should be
VBA Code:
If IsNumeric(cell) = True Then
But IsNumeric has it flaws, have a look here
 
Upvote 0
Hi both,

Thanks for the reply, it resolved why it wasn't working but I see what you mean about the flaws. When running it again with the set up I have it was picking up cells that are both a combination of letters and numbers. Something for me to think about and try and understand the link to the post you noted.

Thanks again.
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,013
Messages
6,122,694
Members
449,092
Latest member
snoom82

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