Simple VBA Code to Copy Value

ionelz

Active Member
Joined
Jan 14, 2018
Messages
264
Office Version
  1. 365
Platform
  1. Windows
Hi,
I want to create a Button to Copy value of cell M3 to corresponding L3 in L4:M25
Thanks

1699804704962.png
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Maybe try...

VBA Code:
Sub ionelz()
    Dim Rng As Range
    Set Rng = Range("L3:L25").Find(Range("L3").Value, , xlValues, , xlByRows, xlNext)
    
    If Not Rng Is Nothing Then
        Rng.Offset(, 1).Value = Range("M3").Value
    End If
End Sub
 
Upvote 0
Solution
Maybe try...

VBA Code:
Sub ionelz()
    Dim Rng As Range
    Set Rng = Range("L3:L25").Find(Range("L3").Value, , xlValues, , xlByRows, xlNext)
   
    If Not Rng Is Nothing Then
        Rng.Offset(, 1).Value = Range("M3").Value
    End If
End Sub
Thank you
 
Upvote 0

Forum statistics

Threads
1,226,216
Messages
6,189,676
Members
453,563
Latest member
Aswathimsanil

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