[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

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

Posted on 2011-09-26
14
Medium Priority
?
229 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 33

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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

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…
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
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…
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

656 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