LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 60
Default VB button not working

I have a VB in my workbook but I'm having trouble with it (I did not write
this I just made some changes to fit my workbook). I have 26 different sheets
(one for each months individual product movements-we track start and finish
time , one for each months totals, we track the number of times the 30 or so
different products were handled each months (I have a SUMPRODUCT taking care
of this part), plus we have a sheet totalling the years total of all
movements. It took me a month to get all of this setup, what I am trying to
do is have a USERFORM to fill out all of the info of the movements because we
have 15 different people filling out the movement at different times because
we are on a shared drive.

PROBLEM I keep getting a RUN-TIME ERROR '9' when I debug it highlights a
line in me VB, it is the fourth row down. My workbook sheets are like this
JAN 07, JAN TOTALS, FEB 07, FEB TOTALS... plus our total tally sheets.

Private Sub cmdAdd_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("MAR 07")
'find first empty row in database
iRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row

'check for a barge number
If Trim(Me.txtBargeID.Value) = "" Then
Me.txtBargeID.SetFocus
MsgBox "Please enter a barge name"
Exit Sub
End If

'copy the data to the database
ws.Cells(iRow, 1).Value = Me.txtBargeID.Value
ws.Cells(iRow, 2).Value = Me.txtProd.Value
ws.Cells(iRow, 3).Value = Me.txtStartDate.Value
ws.Cells(iRow, 4).Value = Me.txtFinishDate.Value
ws.Cells(iRow, 9).Value = Me.txtLorP.Value


'clear the data
Me.txtBargeID.Value = ""
Me.txtProd.Value = ""
Me.txtStartDate.Value = ""
Me.txtFinishDate.Value = ""
Me.txtLorP.Value = ""
Me.txtBargeID.SetFocus

End Sub
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
double-click mouse button not working squeezerfan Excel Discussion (Misc queries) 0 November 6th 06 09:28 PM
tab button not working in excel Traci Excel Discussion (Misc queries) 1 November 30th 05 09:38 PM
Tab button not working properly Mike J Setting up and Configuration of Excel 3 June 4th 05 12:14 AM
command button isn't working Nydia New Users to Excel 1 April 29th 05 10:31 PM
Mouse right button not working Jerry S Excel Worksheet Functions 3 April 4th 05 01:35 AM


All times are GMT +1. The time now is 03:17 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"