ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Replace Null value in Coloumn (https://www.excelbanter.com/excel-discussion-misc-queries/54374-replace-null-value-coloumn.html)

Plumdodge

Replace Null value in Coloumn
 
I am relatively new to Excel VBA and work primarily with Access. For a
spreadsheet which require frequent importation into Access I need to replace
all null cells in Coloumn A with the value from the cell directly above it.

I.E.

A B C
1 45
2 Null

I would want to replace the blank cell of A2 with the value of 45 from A1.
This macro would go through a various range because the number of rows vary
in length. It would just need to stop at the last row that has a value
present in Coloumn A.

Any ideas or suggestions?

Bob Phillips

Replace Null value in Coloumn
 

For i = 2 To Cells(Rows.Count,"A").End(xlUp).Row
If Cells(i,"A").Value = "" Then
Cells(i,"A").Value = Cells(i-1,"A").Value
End If
Next i

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Plumdodge" wrote in message
...
I am relatively new to Excel VBA and work primarily with Access. For a
spreadsheet which require frequent importation into Access I need to

replace
all null cells in Coloumn A with the value from the cell directly above

it.

I.E.

A B C
1 45
2 Null

I would want to replace the blank cell of A2 with the value of 45 from A1.
This macro would go through a various range because the number of rows

vary
in length. It would just need to stop at the last row that has a value
present in Coloumn A.

Any ideas or suggestions?




Plumdodge

Replace Null value in Coloumn
 
Bob,
Thank you very much for the Help!

"Bob Phillips" wrote:


For i = 2 To Cells(Rows.Count,"A").End(xlUp).Row
If Cells(i,"A").Value = "" Then
Cells(i,"A").Value = Cells(i-1,"A").Value
End If
Next i

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Plumdodge" wrote in message
...
I am relatively new to Excel VBA and work primarily with Access. For a
spreadsheet which require frequent importation into Access I need to

replace
all null cells in Coloumn A with the value from the cell directly above

it.

I.E.

A B C
1 45
2 Null

I would want to replace the blank cell of A2 with the value of 45 from A1.
This macro would go through a various range because the number of rows

vary
in length. It would just need to stop at the last row that has a value
present in Coloumn A.

Any ideas or suggestions?






All times are GMT +1. The time now is 07:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com