I'm not sure there is a way to do this, but if there is, I'd be very grateful to anyone who can help.
I have spreadsheet where I want the customer to be able to click a cell and have it put in another line for them. My problem is, with the macro I have now, it continues to add lines indefinately every time you click the sheet. I want it to only add one line.
This is what I have so far:
which goes to this:
Sub InsertRowsAndFillFormulas(Optional vRows As Long = 0) Dim x As Long ActiveCell.EntireRow.Select Dim sht As Worksheet, shts() As String, i As Integer ReDim shts(1 To Worksheets.Application.ActiveWorkbook. _ Windows(1).SelectedSheets.Count) i = 0 For Each sht In _ Application.ActiveWorkbook.Windows(1).SelectedSheets Sheets(sht.Name).Select i = i + 1 shts(i) = sht.Name x = Sheets(sht.Name).UsedRange.Rows.Count Selection.Resize(rowsize:=2).Rows(2).EntireRow. _ Resize(rowsize:=vRows).Insert Shift:=xlDown Selection.AutoFill Selection.Resize( _ rowsize:=vRows + 1), xlFillDefault On Error Resume Next Selection.Offset(1).Resize(vRows).EntireRow. _ SpecialCells(xlConstants).ClearContents Next sht Worksheets(shts).Select End Sub
Thanks in advance for your help!