Subject: add column in excel with VBA
Posted By: exarkuun Post Date: 11/18/2003 4:10:26 PM
Hi,

   I would like know how can i add column between others columns with VBA , exemple when someone click on a button.

        thanks you



Reply By: chrislepingwell Reply Date: 11/19/2003 6:07:48 AM
Try something like this:


Sub Test()
Dim x as string

x = InputBox("Enter the column you need inserting, eg "a")

Workbooks("yourworkbook").worksheets("theworksheet").Columns(x).Insert

End Sub


Create your button, link its code to this sub, and you're away.  Obviously, you will need to alter the names to suit application, and you will need some way of ensuring that the input is valid, but this is left as an exercise for the reader

HTH


There are two secrets to success in this world:
1. Never tell everything you know
Reply By: exarkuun Reply Date: 11/19/2003 8:37:45 AM
Thanks you very much for the solution...




Go to topic 6677

Return to index page 1002
Return to index page 1001
Return to index page 1000
Return to index page 999
Return to index page 998
Return to index page 997
Return to index page 996
Return to index page 995
Return to index page 994
Return to index page 993