VBA Help, Find, Copy & Paste

KitK369

New Member
Joined
Aug 27, 2018
Messages
14
I'm very new to VBA and figuring it out through YouTube videos and online google searches. I'm having some problems finding out how to do an If Then statement in VBA.

I have the same text that can be found in either cell A47 or B47. The text is "Other." I want to do an If statement that says if the text "Other" is found in Cell B47 to copy and paste it into cell A47. However, if the text doesn't appear in cell B47 I don't want it to do anything because it already exists in cell A47. I will also need for it to repeat throughout my workbook for each tab within. These tabs all have different names so I can't reference "Sheet1, Sheet2, etc." I would also prefer not to use any msg boxes or activate buttons.

Anyone know how to accomplish this?

Your help will be greatly appreciated!
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Try this:
Code:
Sub MyCopy()

    Dim ws As Worksheet
    
    For Each ws In Worksheets
        If ws.Range("B47") = "Other" Then ws.Range("A47") = ws.Range("B47")
    Next ws
            
End Sub
 
Upvote 0
This worked! And was way less complicated than anything I was finding online. Thank you so much for the help!
 
Upvote 0
You are welcome.
Glad I was able to help!
:cool:
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,198
Members
452,617
Latest member
Narendra Babu D

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