I'm building a small interface and I need the user to input a value (from 1 to 50) in one cell, and for the spreadsheet to dynamically create a little table with the number of columns they enter. Here's the code I'm using -- its crashing my Excel 2007. Just an FYI, its running in compatability mode b/c the original file was started in Excel 2003:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim i As Integer, nl As Integer
nl = Cells(20, 4).Value
For i = 1 To nl
Cells(23, 4 + i).Value = i
Next i
End Sub
Thanks in advance for why it might be crashing.
ieJasonW
Private Sub Worksheet_Change(ByVal Target As Range)
Dim i As Integer, nl As Integer
nl = Cells(20, 4).Value
For i = 1 To nl
Cells(23, 4 + i).Value = i
Next i
End Sub
Thanks in advance for why it might be crashing.
ieJasonW