Solved

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

Posted on 2011-09-26
14
221 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
Comment Utility
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 31

Expert Comment

by:Rob Henson
Comment Utility
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
Comment Utility
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
 

Author Comment

by:mnoisette
Comment Utility
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
Comment Utility
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
Comment Utility
Jan24:
The sheet names are a constant as well as the cells....
0
 
LVL 2

Expert Comment

by:jan24
Comment Utility
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:mnoisette
Comment Utility
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
Comment Utility
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
Comment Utility
Going with number 1 would be the better one....
Thanks!
0
 
LVL 2

Accepted Solution

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

Author Comment

by:mnoisette
Comment Utility
Beautiful! That's what I needed....
0
 

Author Closing Comment

by:mnoisette
Comment Utility
Awesome!!!
0
 
LVL 2

Expert Comment

by:jan24
Comment Utility
You're welcome!
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

INDEX and MATCH can be used to great effect to replace HLOOKUP and VLOOKUP as it does not have the limitation of needing the data to be sorted so that the reference value is in the first column or row. It also has the ability to perform a bi-directi…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…

728 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now