How to project data from 1 sheet to another but remove columns with no data below header.

johnmpc

New Member
Joined
Oct 19, 2020
Messages
28
Office Version
  1. 365
Platform
  1. Windows
Hi All,

I have an input sheet for placing clothing orders. I then have a separate output sheet that displays the data in a way i can copy and paste what is needed to send back out.

I have Small medium large Xlarge XXlarge sizes in column headers, but what i want is if any columns below the header are empty i don't want to display the column or header.

Is that possible?
 

johnmpc

New Member
Joined
Oct 19, 2020
Messages
28
Office Version
  1. 365
Platform
  1. Windows
Hurrah, It works. Thank you
However, the automated update skipping back to the first sheet bit makes it really clunky. Anything i can do apart from run the macro manually?
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
17,916
Office Version
  1. 2013
Platform
  1. Windows
Hurrah, It works. Thank you
However, the automated update skipping back to the first sheet bit makes it really clunky. Anything i can do apart from run the macro manually?
Show me the line of code that causes the skipping back to first sheet.
At the end of the script what sheet do you want as the active sheet?
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
59,397
Office Version
  1. 365
Platform
  1. Windows
the automated update skipping back to the first sheet bit makes it really clunky.
What is clunky about it? You should only see a quick "flash/blip".

If you do not want it to happen automatically with the update of each individual cell, then you need a way to alert Excel VBA when to run it, either manually, or by some other indicator.
If you can explain how/when you want it to run, we may be able to modify the code to do that.
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
59,397
Office Version
  1. 365
Platform
  1. Windows
Show me the line of code that causes the skipping back to first sheet.
At the end of the script what sheet do you want as the active sheet?
I can handle it, thanks.
 

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
17,916
Office Version
  1. 2013
Platform
  1. Windows

ADVERTISEMENT

Here is a simple script that will take you back to where ever you want:
VBA Code:
Sub Go_To_Sheet()
'Modified  10/6/2021  10:48:31 AM  EDT
Application.Goto Sheets("Master").Range("A1")
End Sub
 

johnmpc

New Member
Joined
Oct 19, 2020
Messages
28
Office Version
  1. 365
Platform
  1. Windows
What is clunky about it? You should only see a quick "flash/blip".

If you do not want it to happen automatically with the update of each individual cell, then you need a way to alert Excel VBA when to run it, either manually, or by some other indicator.
If you can explain how/when you want it to run, we may be able to modify the code to do that.
I have to enter anything up to 40-50 values so even the slightest hesitation slows it down.
I've currently stuck an update button on the 2nd sheet but would it be possible to have the script run when the 2nd sheet is clicked on?
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
59,397
Office Version
  1. 365
Platform
  1. Windows

ADVERTISEMENT

I've currently stuck an update button on the 2nd sheet but would it be possible to have the script run when the 2nd sheet is clicked on?
Yes, that can be done very easily.

Go to the 2nd sheet in Excel and right-click on the sheet tab name at the bottom of the screen.
Then select "View Code", and paste this code in the resulting VB Editor window that pops up:
VBA Code:
Private Sub Worksheet_Activate()
    Call MyDeleteColumns
End Sub
This will automatically run this code whenever that sheet is activated.
(and be sure to delete the "Worksheet_Change" procedure, as you no longer need that)
 

johnmpc

New Member
Joined
Oct 19, 2020
Messages
28
Office Version
  1. 365
Platform
  1. Windows
Thanks for your help. Runs well and looks good now.
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
59,397
Office Version
  1. 365
Platform
  1. Windows
You are welcome!

Note that I re-marked the solution as the post that contains the "big" procedure, as that is the one that most directly addresses the original question asked.
This last bit just is a corollary to run that code.
 

Forum statistics

Threads
1,143,689
Messages
5,720,310
Members
422,275
Latest member
Maria95

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top