Replace data in column H based on current cell in H and total rows in column A

jpsanicky

New Member
Joined
Sep 22, 2018
Messages
12
Greetings and thanks for all the help. One more here for this projects
I have worksheet that has data copied from another and columns updated with a replace function. This works great starting from A2 to the end of rows in A. However I now add data from another sheet to the end of A:900 extending the range of A to A:1800 past the initial replace. The amount of data varies with each upload. Now I need to replace blank cells in H:901 from where we left off with new data to the new end of A:1900. Example of desired results below

This code worked great to replace in column H from A2:

With Range("A2", Range("A" & Rows.Count).End(xlUp))
.Replace What:="", Replacement:="302", LookAt:=xlWhole, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
.Offset(, 7).Value = "302"
End With

When I paste new data at the end of current A, say A:901 I park the cursor at the next cell in H:901

Dim ws As Worksheet
Set ws = ActiveSheet
For Each cell In ws.Columns(8).Cells
If Len(cell) = 0 Then cell.Select: Exit For
Next cell

How do I replace "" with "123" from the ActiveCell H:993 position to the end of A?


RowABCDEFGH
988TedEBear 302
989TedEBear 302
990TedEBear 302
991TedEBear 302
992TedEBear 302
993WillIAm 123
994WillIAm 123
995WillIAm 123
996WillIAm 123
997WillIAm 123

<colgroup><col><col><col><col><col><col><col><col><col></colgroup><tbody>
</tbody>
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
How about
Code:
   Range(Range("H" & Rows.Count).End(xlUp).Offset(1), Range("A" & Rows.Count).End(xlUp).Offset(, 7)).Value = 123
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,214,644
Messages
6,120,709
Members
448,983
Latest member
Joaquim_Baptista

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