We help IT Professionals succeed at work.

Demo Macro

Bright01
Bright01 asked
on
EE Pros,

I have a Workbook that has multiple Worksheets.  One of the WSs is a Demo WS that has a list of content and which fields on which WSs the content should go when the Demo macro is triggered.  I've attached a strawman for you to take a look at to see what I'm trying to accomplish.  

The reason for separating out the Demo WS is that over time, I'll change the numbers and content but still want it to populate the WSs in the same locations.

Thank you in advance,

B.
Demo.xls
Comment
Watch Question

Martin Liss"There is still no cure for the common birthday." ~John Glenn
Most Valuable Expert 2017
Distinguished Expert 2018

Commented:
The macro is missing an "End With" and it's looking for a sheet named "Customer - Inputs" that doesn't exist, but ignoring that, what is it that you want to do?

Author

Commented:
Martin,

Thanks for the response.  Delete anything in the module....that was my feeble attempt to start building a macro.   Then I got the inspiration to separate it out to a Demo Tab so it could quickly be changed.  That's when I authored the question.

What I'm trying to get done is when you fire the "Demo" macro, it populates the content (Demo Tab) into the specified Worksheets and fields identified.

Thanks again,

B.
"There is still no cure for the common birthday." ~John Glenn
Most Valuable Expert 2017
Distinguished Expert 2018
Commented:
Try this
Q-28624123.xls
Top Expert 2015

Commented:
Use this code...

Sub populate_data()
Dim ws As Worksheet, ws1 As Worksheet, ws2 As Worksheet

Set ws = Sheets("Demo")
Set ws1 = Sheets("Questions")
Set ws2 = Sheets("Splash")

ws2.Range("N12:N19").Value = ws.Range("M10:M17").Value
ws1.Range("B4").Value = ws.Range("M18").Value
ws1.Range("B7:B8").Value = ws.Range("M18:M19").Value

End Sub

Open in new window


Saurabh

Author

Commented:
Martin,  I almost got it to work!  I have one little issue, if I need to simulate a double mouse click, in column O in the Demo Tab, is there a way to do that?  I have a reason for needing to do it because when a selection is actually done in the model, it causes a trigger for another macro.  So by simply sending the content over, it doesn't trigger the other macro.  Like in O18 (Demo Tab), instead of it reading send "2" to B4 in the Questions Tab, it would actually cause a double click action in B4 in the Questions tab?  In other words the content would actually be an action instead of a value.........

Saurabh, I think Martin's code gives me the flexibility I need for the task.  Thank you for adding an option.

B.
Martin Liss"There is still no cure for the common birthday." ~John Glenn
Most Valuable Expert 2017
Distinguished Expert 2018

Commented:
Then add this code.

Range("B4").Select
Worksheet_BeforeDoubleClick ActiveCell, False

Author

Commented:
Martin,

Sorry but I'm a little confused.  Let me explain this in a little more detail.  In my list in the Demo Tab, I have one set of references, where it is required that at least one of the references has a double click.  This is because in the production version (vs. the demo), you have to double click on a cell for a check mark to appear.   In order for the demo to work with the right content, I have to simulate a single check mark on one of the referenced cells.  

So your add above, where in the code do I put it?  And how does the macro know which content cell to act the double click on?  I don't want a double click on every sell....just one specific one that will trigger the macro in the production version to populate properly.

I hope that makes sense.

B.
Martin Liss"There is still no cure for the common birthday." ~John Glenn
Most Valuable Expert 2017
Distinguished Expert 2018

Commented:
Do I assume correctly that in production that there won't be a button like the "Demo Button" button?

If that's true then what process populates the other sheets with the Demo sheet's information?

Where does the checkmark appear?

How do I tell which cell to double-click?

Could you possibly attach your production workbook?

Author

Commented:
Martin,

Thank you very much!  Can I purchase an hour of time from you?

B.