Solved

VBA Prompt to enter the same data in multiple cells on multiple worksheets.

Posted on 2011-09-26
14
222 Views
Last Modified: 2012-05-12
I have an Excel 2007 Workbook with mutiple worksheets. On Sheets 2, 3, 4, 5, and 6 the data is in the same location. I would like a macro that will put the same data in the same cell on each on of those sheets... e.g. (Sheet1:Sheet6!B4).
When the macro runs, I would like a prompt that will ask the user what the input will be...
0
Comment
Question by:mnoisette
  • 7
  • 6
14 Comments
 
LVL 2

Expert Comment

by:jan24
ID: 36600501
Hi mnoisette.
I know you asked for a macro, but before we go down that route let me just check in case the following delivers the functionality you need.
If you select all those sheets (i.e. select multiple sheets at once by CTRL-click or SHIFT-click on the tabs) then, when you enter data, it will enter it on all the sheets at once.  For example if you entered "hello" in cell A1, then "hello" would appear in cell A1 on all of the selected sheets.
It works with entering formulae too.
0
 
LVL 32

Expert Comment

by:Rob Henson
ID: 36600672
If there is data copied between sheets, why not have one input sheet and have the other sheets linked to that input sheet.

Using Jan24's example

Sheet1!A1 > Hello   (manual entry)
Sheet2!A1 > =Sheet1!A1  (formula entry, copying sheet 1 entry).
Sheet3!A1 > =Sheet1!A1  (formula entry, copying sheet 1 entry).

If this is the way to go, as mentioned by jan24, doing the multiple sheet select when entering the formula on the linked sheets will enter the same formula in the same cell on all selected sheets.

Apologies if making it sound too simplistic.

Thanks
Rob H
0
 

Author Comment

by:mnoisette
ID: 36600705
That is correct. I do know that method for three demesional data, but there are many sheets and many cells that need the info. If the macro is set up ocnce, it would prevent the user from leaving out a cell when selecting the cells for the data. It may need to be something like (Sheet1:Sheet10!A1,D1, F1, H1) just as an example.
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 

Author Comment

by:mnoisette
ID: 36600722
The reference cell may be an option, but for some reason, these people are bent on doing a macro.
0
 
LVL 2

Expert Comment

by:jan24
ID: 36600752
Can we guarantee that the sheetnames will always be Sheet1, Sheet2, Sheet3, etc etc
If so then your suggested format Sheet1:Sheet10 should work.
If not, it may be best if the macro gives a dialog box where the user can select the desired sheets.
Which of those approaches works best for you?
0
 

Author Comment

by:mnoisette
ID: 36601093
Jan24:
The sheet names are a constant as well as the cells....
0
 
LVL 2

Expert Comment

by:jan24
ID: 36601102
Here's an attempt using the first of the two approaches.   Instructions:
1) Click the button "Enter data on multiple sheets"
2) Fill in the sheets you want to process, e.g. Sheet1:Sheet10
3) Fill in the range you want to affect, e.g. A1,D1, F1, H1
4) Fill in the value you want to enter
5) Click OK

It assumes that your sheets are all named Sheet1, Sheet2, etc.  If you enter Sheet1:Sheet10 and Sheet7 was missing then it will throw an error and do nothing.  I thought this was the safest behaviour.  If you would instead like it to skip Sheet7 and carry on then let me know.
Book11.xlsm
0
 

Author Comment

by:mnoisette
ID: 36601362
Is there a way to enter the sheet names if they are non-adjacent? And, the sheet names are constant, but they are not named "Sheet". The cell and and the text part work perfectly!
0
 
LVL 2

Expert Comment

by:jan24
ID: 36601617
Sure.  I can see two ways of doing it:
1) Have a multiselect in the dialog box, so you can select whichever sheets you want (and shift-click) to select a range.  This would allow it to cope with any sheet names.
2) Use a format like 'Sheet1:Sheet5,Sheet7,Sheet9:Sheet10' as for the cell references.

(1) is probably easier if it's all the same with you, but let me know which you prefer.
Also, if you want to go with (2) then I'll need you to tell me what they are all called if it isn't 'Sheet'.
0
 

Author Comment

by:mnoisette
ID: 36602147
Going with number 1 would be the better one....
Thanks!
0
 
LVL 2

Accepted Solution

by:
jan24 earned 250 total points
ID: 36707817
Ok.  Try this - let me know if it works.
Book11.xlsm
0
 

Author Comment

by:mnoisette
ID: 36708012
Beautiful! That's what I needed....
0
 

Author Closing Comment

by:mnoisette
ID: 36708014
Awesome!!!
0
 
LVL 2

Expert Comment

by:jan24
ID: 36708151
You're welcome!
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Drop Down List with Unique/Distinct Values (Part II - ComboBox or ListBox and Data Validation List Bonus!) David Miller (dlmille) Intro This article focuses on delivering unique, sorted lists to list objects (e.g., ComboBox, ListBox) and Dat…
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question