MACROS - Copy info from another spreadsheet, selected from a drop-down list

LitoII

New Member
Joined
Jul 25, 2012
Messages
12
Hi.

I have a workbook with 150+ spreadsheets. In another spreadsheet I've managed to make the drop-down list with all the names of the spreadsheets in an A1 cell. When something from the drop-down menu is selected (there will be a spreadsheet with the very same name), the information from the spreadsheet with the same name as the selected word in the A1 cell has to get copied in the spreadsheet with the drop-down menu.

I hope I have explained my issue quite clearly. If not - please, ask!

Thank you very much in advance.

Mike
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Maybe:

Code:
Sub LitoII()

Dim ws As Worksheet
Dim x As String

Set ws = ActiveSheet

x = Range("A1").Value

Sheets(x).UsedRange.Copy ws.Range("A" & Rows.Count).End(3)(2)


End Sub
 
Upvote 0
Thank you for the quick reply, but when I am to run it, nothing happens (I've only copied it in a new module and clicked CTRL+S before that)

Also, is it possible to copy only the cells from A4 to E63 from the respective spreadsheet?
 
Upvote 0
It worked when I tested it.

Code:
Sub LitoII()

Dim ws As Worksheet
Dim x As String

Set ws = ActiveSheet

x = Range("A1").Value

Sheets(x).Range("A4:E63").Copy ws.Range("A" & Rows.Count).End(3)(2)


End Sub

Not sure why it's not working? This modification would copy the range you requested.
 
Upvote 0
hmm, it's odd, still nothing happens :/

Actually, does the 'Copy' command also paste the selected text? And does the 'Value' describe the argument as text as well?
 
Upvote 0
The copy command with a space should paste to the destination. You can try without the Value and see what happens. I the problem resides in your Range("A1") or your Sheet names. See my PM.
 
Upvote 0
hmm, it's odd, still nothing happens :/

Actually, does the 'Copy' command also paste the selected text? And does the 'Value' describe the argument as text as well?

Mike:

I received your email and tested the macro with your sample data. See my reply. I think it's just a matter of clarity of what you want to happen. As it is written the macro works.
 
Upvote 0
hmm, it's odd, still nothing happens :/

Actually, does the 'Copy' command also paste the selected text? And does the 'Value' describe the argument as text as well?

OK, Mike. I thought it was just a misunderstanding, try this:

Code:
Sub LitoII()

Dim ws As Worksheet
Dim x As String

Set ws = ActiveSheet

x = Range("A1").Value

Sheets(x).Range("A4:E63").Copy ws.Range("A4" )

End Sub
 
Upvote 0

Forum statistics

Threads
1,215,636
Messages
6,125,961
Members
449,276
Latest member
surendra75

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