Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi All
I have been using the code below -- Cmd1 is a list box with 24 names what I need is when I click on the next name on the list it will insert the data on the next row down. At the moment I understand that its selecting a range "D2" etc so every time I add it replaces the value in "D2"etc and not in "D3" which is the next row --- I hope I've explained this OK Private Sub Add6_Click() startrownum = 2 endrownum = 25 For rownum = startrownum To endrownum If Trim(Sheets("ClubsPayment").Range("A" & Trim(Str(rownum)))) = "" Then freerownum = rownum rownum = endrownum End If Next rownum Sheets("ClubsPayment").Range("D" & Trim(Str(freerownum))) = Cmd1.Value Sheets("ClubsPayment").Range("D2") = Box2.Value Sheets("ClubsPayment").Range("E2") = Box3.Value Sheets("ClubsPayment").Range("F2") = Box9.Value Sheets("ClubsPayment").Range("G2") = Box10.Value Sheets("ClubsPayment").Range("H2") = Box11.Value Sheets("ClubsPayment").Range("I2") = Box12.Value Sheets("ClubsPayment").Range("J2") = Box13.Value Sheets("ClubsPayment").Range("K2") = Cmd3.Value Sheets("ClubsPayment").Range("L2") = Box14.Value End Sub -- Many thanks hazel |