Adding checkboxs to excel is way too slow

barse

Member
Joined
Jan 20, 2005
Messages
6
Programming Experience
5-10
Hi,
I'm adding (on-the-fly) checkboxs for every row in my excel sheet. I don't know how many rows I'll have before I start.
Here's my code whihc works fine but it takes about 4 minutes for 3500 rows!!!
Is there a faster way to do this?

Dim chk As Excel.Shape
Dim iRow As Integer
dim dt As DataTable

For iRow = 0 To dt.Rows.Count - 1
chk = oSheet.Shapes.AddFormControl(Excel.XlFormControl.xlCheckBox, oCells(iRow + 3, 6).Left + 22, oCells(iRow + 3, 6).Top - 1, 10, oCells(iRow + 3, 6).Height - 1)
chk.TextFrame.Characters.Text = ""
chk.OnAction = "Process_CheckBox"
Next
 
Back
Top