Line code to convert number into value

olympiac

Board Regular
Joined
Sep 26, 2010
Messages
158
Code:
For Each rng In Range("A1:BZ1")
If rng.Value = "Column Name here" Then
rng.EntireColumn.Select
For Each xCell In Selection
xCell.Value = CDec(xCell.Value)
Next xCell
End If
Next rng
[Code/]
 
The code above converts number into value however if the column heading is selected the code doesn't work.
How can I modify it to exclude the column heading in the selction?
 
Thanks
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Perhaps

Code:
For Each Rng In Range("A1:BZ1")
    If Rng.Value = "Column Name here" Then
    For Each xCell In Rng.EntireColumn
        If IsNumeric(xCell.Value) Then xCell.Value = CDec(xCell.Value)
    Next xCell
    End If
Next Rng
 
Upvote 0

Forum statistics

Threads
1,224,595
Messages
6,179,799
Members
452,943
Latest member
Newbie4296

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