Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Can anyboby help me!
I'm trying to write a code that finds the next empty row between "C10 to C19" on "sheet2" using a command button(1) on "sheet1" of a workbook. Then find the next empty cell in that row and insert the data from 5 textboxes (in a userform(1)) to the respective cells. And then clear the data in the textboxes. What I have so far is this and it's not workin: Private Sub CommandButton1_Click() Dim iRow As Long Dim ws As Worksheet Set ws = Worksheets("sheet2") 'find first empty row in database For iRow = 10 To 19 If Application.CountA(Rows(iRow)) = 0 Then MsgBox (iRow) Exit Sub End If Next MsgBox ("Worksheet has no empty rows.") 'check for a part number If Trim(Me.TextBox1.Value) = "" Then Me.TextBox1.SetFocus MsgBox "Please enter a date" Exit Sub End If 'copy the data to the database ws.Cells(10, 3).Value = Me.TextBox1.Value ws.Cells(10, 4).Value = Me.TextBox2.Value ws.Cells(10, 5).Value = Me.TextBox3.Value ws.Cells(10, 6).Value = Me.TextBox4.Value ws.Cells(10, 7).Value = Me.TextBox5.Value 'clear the data Me.TextBox1.Value = "" Me.TextBox2.Value = "" Me.TextBox3.Value = "" Me.TextBox4.Value = "" Me.TextBox5.Value = "" Me.TextBox1.SetFocus End Sub -- ASU |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Custom functions calculating time arguments Help Desperate | Excel Worksheet Functions | |||
Dropping the cell in the empty cell by formula | Excel Discussion (Misc queries) | |||
How do I set a cell to "Empty" so that it does not display in a ch | Charts and Charting in Excel | |||
make a cell empty based on condition | Charts and Charting in Excel | |||
GET.CELL | Excel Worksheet Functions |