select column (with blanks to fill) based on cell from other column

excel01noob

Board Regular
Joined
Aug 5, 2019
Messages
51
Office Version
  1. 365
  2. 2016
Hello

I have a table with several columns.
The main one is column N where I want to take action as it is filled with "net amounts" but in text, plus not all the cells are filled, some have blanks, some others have zero also in text format.

I wanted to use column A "ref ID" to identify last row non-blank in that column which would define the last row in column "net amounts".
I want then to convert the numbers in text format into numbers with 2 decimals plus adding zeros in blank cells (what action should I take first here?)

I managed to do this

Dim LastRow as Long
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
Range("N" & LastRow).Select


but now how to select the column N going up until cell 2 (i am using headers) with the above criteria also included?
 

Excel Facts

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

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
12,623
Office Version
  1. 2007
Platform
  1. Windows
Try this

VBA Code:
Sub Select_Column()
  Dim rng As Range, c As Range
  Set rng = Range("N1:N" & Range("A" & Rows.Count).End(3).Row)
  rng.NumberFormat = "#,##0.00"
  For Each c In rng
    If IsNumeric(c.Value) Then
      c.Value = c.Value * 1
    ElseIf c.Value = "" Then
      c.Value = 0
    End If
  Next
End Sub
 
Last edited:

Watch MrExcel Video

Forum statistics

Threads
1,130,179
Messages
5,640,625
Members
417,159
Latest member
Mayozero

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
Top