VBA code to paste clipboard into a Variable

Mary90

New Member
Joined
Sep 8, 2015
Messages
22
Hi everyone.:biggrin:

Still quite new to using VBA, but learning a lot on this forum.;)

I'm writing a couple of simple macros to add to my personal workbook and then assign keyboard shortcuts to them to simplify everyday use. Things like paste values, add borders, make headings, etc...

One of the shortcuts I'd like to make is a quick Goto. Currently in Excel, when you type a cell address into the Name box, you get taken there directly. I want to copy a cell reference into the clipboard (Something like "Sheet3!B11") and then pres my keyboard shortut to run the macro.

The macro should then:
paste the copied value into a String variable
Go to the variable

What I have:
Code:
Sub QuickGoto()
Dim New_Ref As String


New_Ref = Paste 'This is where I have my issue. How to paste the copied value directly into my variable?


    Application.Goto Reference:=New_Ref
End Sub
Any ideas / suggestions?

Thanks in advance!
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)

Forum statistics

Threads
1,213,536
Messages
6,114,207
Members
448,554
Latest member
Gleisner2

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