Macro Command to run other Macro

  • Thread starter Thread starter Matt
  • Start date Start date
M

Matt

I am currently trying to create a macro which will run a
number of defined macros dependent on the number of
columns in a worksheet.

For example, if there are 2 columns in the workbook, I
want the first macro to run macro called 2, but if there
are 3 columns, I want it to launch macro called 3.

Any ideas?

Thanks in advance for any assistance.
 
All workbooks have 256 columns, so I think you need more info.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Hi Bob.

Sorry, I wasn't very clear!

I meant that I want it to run a specific macro dependent
on how many columns contained data! I have seen something
similar where a macro counts the number of rows with data
in.

Many thanks

Matt
 
Hi Matt,

You can get that with

worksheetFunction.CountA(Range("1:1"))



--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top