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

excel01noob

New Member
Joined
Aug 5, 2019
Messages
45
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?
 

Some videos you may like

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
12,618
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,127,199
Messages
5,623,321
Members
415,966
Latest member
ctorohuamanchumo

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