How JustAnswer Works:

  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.

Ask Richard Your Own Question

Richard
Richard, Software Specialist
Category: Microsoft Office
Satisfied Customers: 31124
Experience:  Over 15 year experience resolving Microsoft Office Issues
32989067
Type Your Microsoft Office Question Here...
Richard is online now
A new question is answered every 9 seconds

Not sure if my question should be asked here under VBA or Excel.

This answer was rated:

Not sure if my question should be asked here under VBA or Excel. I'm trying to create a simple macro to look at a row of data, if there is a match in a cell to hide that specific column and then move on to the next cell in that same row. The macro would be executed from another sheet in the workbook. thanks.
Thank you for your question, my name is Richard.

you have made the question to the right place.

I can write the macro for you, but I need to see the Excel File.

Can you upload it to me using the following instructions.

- Click the following link: http://www.wikisend.com
- Upload the file to that website
- Once it is uploaded, the resulting page will display a "File ID" number.
- Please, give me that "File ID Number"

Also tell me the row to check and which value should be matched.

Thank you
Customer: replied 3 years ago.


Hi Richard, sorry I can't send the original, but I made a sample spreadsheet for you. Note the original spreadsheet has many more columns of data.


 


There might be a better way to do this, but the first row in the DATA sheet is the row that will need to be checked for the word AIR or VENDOR, if there is a match then hide that column. The Main sheet Is were the macro start buttons are. I also need this to work from Excel 2010.


 


The file id is 447058.


 


Thanks.

Customer: replied 3 years ago.


Oh I forgot to mention that row one will be hidden from view in the normal state prior to any macros being run, thanks

This is now done for you Rubin

The File ID is 262322

If you have any problems, or would like any additional information or assistance, please do not hesitate to let me know.

And if you can take a second to rate my service, that would be greatly appreciated.

Thank you
Customer: replied 3 years ago.


Richard, I think we must have miscommunicated, I need the columns to be hidden versus the rows, thanks.

No problem, I corrected this for you.

You can download it with File ID 651948

Let me know if you have any difficulties please

Customer: replied 3 years ago.


Richard, there is still something wrong, the unhide macro seems to be working, but the hide air and hide vendor is only partially working; only some of the columns that have these key words (AIR an Vendor) are being hidden, thanks.

Ruben

It hides the columns that the value is in.

You want all columns from A to J hidden? Then there is nothing displayed anymore on the worksheet.

Customer: replied 3 years ago.


Richard, here is a summary of how it should work.


 


If I select the HIDE AIR macro it should hide all columns that have the word AIR in row 1. (Column C,G and I)


 


IF I select the HIDE VENDOR macro I should hide all columns that have the word VENDOR in row 1 (columns A,B,D,E,F,H, and J).


 


Anything you can do to shorten the code would help since the real spreadsheet has about 100 columns.


 


Hope that helps.

ok, so Row 1 is also being checked.

I have added this and you can download it here

286528

I cannot shorten the code, it is all needed.

Let me know if you have any difficulties please

Customer: replied 3 years ago.


Richard only row 1 needs to be checked for the key words (AIR or Vendor depending on the macro), maybe this will shorten the code?

ok, it only shortens it by a couple of lines

You can download it with ID 104806

but the amount of code should not matter, it has no bearing on performance, considering the size of the Macro.

Customer: replied 3 years ago.


It works! Yeah! Last question before I give you an excellent rating, how many macro are being used? I see four in total ( macro2, HideAIR, HideVendor, UnhideAll), but I see code in all of them for that appears to be related to each. Thanks

Sorry, Macro2 was my development area, you dont need that one.

Just HideAIR, HideVendor and UnhideALL

These are the 3 that you need Ruben.

If you need anything else, please do not hesitate to let me know

Thank you
Richard and other Microsoft Office Specialists are ready to help you