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

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
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,214,651
Messages
6,120,744
Members
448,989
Latest member
mariah3

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