Use ISnumeric with cells starting with plusminus ± character

ArnMan

Board Regular
Joined
Aug 30, 2017
Messages
69
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hello,
I have project Im working on, and currently the thing I am doing is searching each cell, from one sheet(Datasheet-C), as each row is copied, to another sheet(Accredited), in a loop, for values or text. That part is working. But I have several cells that contain the Plus/Minus symbol character, and ISnumeric only finds it as a value I believe.

My code below does what I want for values example (450 or 10) from (Datasheet-C) and text example (N/A or * or anything with text. And if there isn't anything in the cell it will be blank in (Accredited)
Now I have several cells that might contain for example ±3% of Capacity both number and text and with ± in the front all the time.

when I run my macro it shows nothing but ± in all my cells whether there is something or not. I am guessing it is because a blank cell = 0 I am not sure. So it may see it as a value, and put the ± and nothing else because there is no value to copy over.
I would rather ± only show up when there is an actual value in Datasheet !M column. Not every cell in I column.
Second part of the question is I would like ±3% of Capacity or whatever it may be to be copied over. Each cell has its own formatting both for cell and for decimals.

So I guess my actual question is, can I get ± to only show when Datasheet-C M Column has an actual value.
And How can I get ±3% of Capacity to show on Accredited?


Code:
Dim lRowAdd As Long
lRow = Sheets("Datasheet-C").Cells(Rows.Count, "AAA").End(xlUp).Row
lRowAdd = lRow
Dim i As Integer
    For i = 7 To lRowAdd
        
        Sheets("Datasheet-C").Range("AAA" & i).Value = 1
        
        Sheets("Datasheet-C").Range("B" & i & ":H" & i).Copy
        Sheets("Accredited").Range("B" & i & ":H" & i).PasteSpecial xlPasteFormats
        
       
    If IsNumeric(Sheets("Datasheet-C").Range("B" & i)) = True Then
            
            
            Sheets("Accredited").Range("B" & i).Value = "=('Datasheet-C'!B" & i & ") & """""
    Else
            
            Sheets("Accredited").Range("B" & i) = "=T('Datasheet-C'!B" & i & ")"
    End If
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
The first post I messed up on the code and copied the wrong section. I've added the correct code, in the code block below, I had plus the addition in red.
Sorry about that.

I changed my vba to this and it doesn't add the plus minus on Accredited sheet from blank cells on Datasheet-C here is what I changed. so now that is working

Code:
Dim lRowAdd As Long
lRow = Sheets("Datasheet-C").Cells(Rows.Count, "AAA").End(xlUp).Row
lRowAdd = lRow
Dim i As Integer
    For i = 7 To lRowAdd
        
        Sheets("Datasheet-C").Range("AAA" & i).Value = 1
        
        Sheets("Datasheet-C").Range("B" & i & ":H" & i).Copy
        Sheets("Accredited").Range("B" & i & ":H" & i).PasteSpecial xlPasteFormats
        
        'Added in red

       [COLOR=#ff0000]If Sheets("Datasheet-C").Range("M" & i).Value = 0 Then
             Sheets("Accredited").Range("I" & i) = "=('Datasheet-C'!M" & i & ") & """""[/COLOR]

       [COLOR=#ff0000]else[/COLOR]
              If IsNumeric(Sheets("Datasheet-C").Range("M" & i)) = True Then
            
            
                   Sheets("Accredited").Range("I" & i).Value = "=""±"" & ('Datasheet-C'!M" & i & ")" & "&" & "('Accredited'!E" & i & ")"
              Else
            
                   Sheets("Accredited").Range("I" & i) = "=T('Datasheet-C'!I" & i & ")"
       End If
 [COLOR=#ff0000]End If[/COLOR]
So that works yay

Now I wonder if I can get it to copy over ±3% of Capacity in to Accredited sheet cell from Datasheet-C.





Hello,
I have project Im working on, and currently the thing I am doing is searching each cell, from one sheet(Datasheet-C), as each row is copied, to another sheet(Accredited), in a loop, for values or text. That part is working. But I have several cells that contain the Plus/Minus symbol character, and ISnumeric only finds it as a value I believe.

My code below does what I want for values example (450 or 10) from (Datasheet-C) and text example (N/A or * or anything with text. And if there isn't anything in the cell it will be blank in (Accredited)
Now I have several cells that might contain for example ±3% of Capacity both number and text and with ± in the front all the time.

when I run my macro it shows nothing but ± in all my cells whether there is something or not. I am guessing it is because a blank cell = 0 I am not sure. So it may see it as a value, and put the ± and nothing else because there is no value to copy over.
I would rather ± only show up when there is an actual value in Datasheet !M column. Not every cell in I column.
Second part of the question is I would like ±3% of Capacity or whatever it may be to be copied over. Each cell has its own formatting both for cell and for decimals.

So I guess my actual question is, can I get ± to only show when Datasheet-C M Column has an actual value.
And How can I get ±3% of Capacity to show on Accredited?


Code:
Dim lRowAdd As Long
lRow = Sheets("Datasheet-C").Cells(Rows.Count, "AAA").End(xlUp).Row
lRowAdd = lRow
Dim i As Integer
    For i = 7 To lRowAdd
        
        Sheets("Datasheet-C").Range("AAA" & i).Value = 1
        
        Sheets("Datasheet-C").Range("B" & i & ":H" & i).Copy
        Sheets("Accredited").Range("B" & i & ":H" & i).PasteSpecial xlPasteFormats
        
       
    If IsNumeric(Sheets("Datasheet-C").Range("B" & i)) = True Then
            
            
            Sheets("Accredited").Range("B" & i).Value = "=('Datasheet-C'!B" & i & ") & """""
    Else
            
            Sheets("Accredited").Range("B" & i) = "=T('Datasheet-C'!B" & i & ")"
    End If
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,165
Members
453,021
Latest member
Justyna P

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