Insert worksheet column from a commonad button


Posted by jay on June 25, 2001 5:53 PM

I need to insert worksheet column from a VB form by clicking a button. When the button is clicked, I activate a worksheet cell and call the worksheet insert method. But it keep hanging and unable to do this. The only way seems to be to hide the VB form just before inserting a column and making it visible, soon after the insert.
Anyone has any thoughts?

Regards

Posted by Dax on June 26, 2001 1:44 AM

Hi,

This works: -

Private Sub CommandButton1_Click()
Range("D1").Columns.Insert
End Sub

Regards,
Dax.



Posted by jay on June 26, 2001 3:59 AM

Hi Dax,

Thanks for the response.

My form has some textboxes and while the focus is on a textbox user click the command button, the insert method didn't work well. I have since then explicitly set focus on the form and thereby been able to get the code to work.

Thanks