Need help with While loop to find and copy data between ws

Woody75

Board Regular
Joined
Feb 26, 2012
Messages
114
Hi everyone,

I'm looking for a macro that does the following:

Sheet1 - Range G2:G65 do while loop ending with "End" - needs to be compared with Sheet 2 Range F3:F2000 Do until ""

each time the first loop finds a non blank value, it jumps into the second loop to look for and replace exact values

Can anyone help, i'm at my wits end... :ROFLMAO: Below is what I have at the minute, please bear with me, i'm trying to teach myself VBA... (it may take a while!!)

Sub FindReplace()


Dim Counter3, Counter4 As Integer
Counter3 = 3
Counter4 = 2


Do Until ThisWorkbook.Sheets("Obs Sheet").Cells(Counter3, 6).Value = ""

If ThisWorkbook.Sheets("Reports Input").Range("G" & Counter4).Value = ThisWorkbook.Sheets("Obs Sheet").Range("F" & Counter3).Value Then

ThisWorkbook.Sheets("Obs Sheet").Range("F" & Counter3).Value = ThisWorkbook.Sheets("Reports Input").Range("A" & Counter4).Value

End If

Counter3 = Counter3 + 1

Loop

End Sub
 
Last edited:

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Cannot determine from your description and code exactly what you are comparing and what you want copied. Can you define a short data example with the expected results.
 
Upvote 0

Forum statistics

Threads
1,214,975
Messages
6,122,538
Members
449,088
Latest member
RandomExceller01

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