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?


[TABLE="width: 514"]
<colgroup><col><col><col><col><col><col><col><col><col></colgroup><tbody>[TR]
[TD]Row[/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]G[/TD]
[TD]H[/TD]
[/TR]
[TR]
[TD]988[/TD]
[TD]Ted[/TD]
[TD]E[/TD]
[TD]Bear[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD="align: right"]302[/TD]
[/TR]
[TR]
[TD]989[/TD]
[TD]Ted[/TD]
[TD]E[/TD]
[TD]Bear[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD="align: right"]302[/TD]
[/TR]
[TR]
[TD]990[/TD]
[TD]Ted[/TD]
[TD]E[/TD]
[TD]Bear[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD="align: right"]302[/TD]
[/TR]
[TR]
[TD]991[/TD]
[TD]Ted[/TD]
[TD]E[/TD]
[TD]Bear[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD="align: right"]302[/TD]
[/TR]
[TR]
[TD]992[/TD]
[TD]Ted[/TD]
[TD]E[/TD]
[TD]Bear[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD="align: right"]302[/TD]
[/TR]
[TR]
[TD]993[/TD]
[TD]Will[/TD]
[TD]I[/TD]
[TD]Am[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD="align: right"]123[/TD]
[/TR]
[TR]
[TD]994[/TD]
[TD]Will[/TD]
[TD]I[/TD]
[TD]Am[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD="align: right"]123[/TD]
[/TR]
[TR]
[TD]995[/TD]
[TD]Will[/TD]
[TD]I[/TD]
[TD]Am[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD="align: right"]123[/TD]
[/TR]
[TR]
[TD]996[/TD]
[TD]Will[/TD]
[TD]I[/TD]
[TD]Am[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD="align: right"]123[/TD]
[/TR]
[TR]
[TD]997[/TD]
[TD]Will[/TD]
[TD]I[/TD]
[TD]Am[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD="align: right"]123[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
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,224,568
Messages
6,179,595
Members
452,927
Latest member
whitfieldcraig

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