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

excel01noob

Board Regular
Joined
Aug 5, 2019
Messages
93
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

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
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:
Upvote 0

Forum statistics

Threads
1,213,561
Messages
6,114,317
Members
448,564
Latest member
ED38

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