?
Solved

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

Posted on 2011-09-26
14
Medium Priority
?
232 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 34

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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 1000 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

807 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