VB in Excel (Form)

Record-Keeping Application

Page 1 of 1

4 Replies - 894 Views - Last Post: 26 June 2008 - 09:42 AM Rate Topic: -----

#1 Kaida  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 34
  • Joined: 19-June 08

VB in Excel (Form)

Posted 25 June 2008 - 07:57 PM

dear fellow programmers, as a noob in all these.. i need some guidance.

i encountered some problem in doing a form-like application in Excel... I need to rpoduce an application that has a form window as an input for the user.. The input data will then be stored in the spreadsheet of Excel... Hence, i have done a little programming in the Macros for this.. somehow, when i run it, there is an error called error '424'. i did this coding in just one module... Please explain what am i to do next, or is there something i should know...but don't? or is there something wrong with d codes?

i got the tutorial to do this from the net.. and did pretty much the same to produce an application somewhat similar to mine... but, what went wrong..? here, i'm pasting the code that i've done. thanks, guys.

Private Sub cmdCancel_Click()

Unload Me

End Sub

Private Sub cmdClear_Click()

Call UserForm_Initialize

End Sub

Private Sub cmdSubmit_Click()

ActiveWorkbook.Sheets("Computer Logbook Form").Activate
Range("A1").Select

Do

If IsEmpty(ActiveCell) = False Then

ActiveCell.Offset(1, 0).Select

End If

Loop Until IsEmpty(ActiveCell) = True

End Sub

Private Sub UserForm_Initialize()

txtComID.Value = ""

With cboDept

.AddItem "CAM"
.AddItem "Drilling"
.AddItem "Human Resource"
.AddItem "Customer Service"
.AddItem "Purchasing"
.AddItem "General Store"
.AddItem "Mechanical Store"

End With

cboDept.Value = ""

txtName.SetFocus

End Sub

Is This A Good Question/Topic? 0
  • +

Replies To: VB in Excel (Form)

#2 AndyH1963  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 22
  • View blog
  • Posts: 201
  • Joined: 22-June 08

Re: VB in Excel (Form)

Posted 25 June 2008 - 11:44 PM

I would suggest that you do a little to help yourself here. In each of your subroutines put:

Private Sub MySub()

   ' declare variables here
   ...

   On error goto ErrHandler

   ' code here
   ...

   Exit sub

ErrHandler:

   Debug.Print "Error: " & Err.number & " " & Err.Description
   Debug.Assert false
   Exit sub
   Resume

End sub



When you encounter an error in any of you subroutines your ErrHandler code will be called and stop execution on the Debug.Assert line, the immediate window will report the error description and number, and you can move to the Resume which will then point you to the point where the error occured. Hopefully this will then enable you to solve the problem. Please report back.

This post has been edited by AndyH1963: 25 June 2008 - 11:45 PM

Was This Post Helpful? 0
  • +
  • -

#3 Kaida  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 34
  • Joined: 19-June 08

Re: VB in Excel (Form)

Posted 26 June 2008 - 12:29 AM

thanks for the feedback, Andy... but... i dont get it.. i dont think i have any variables so far.... what could they be... all i want to do now is to start getting the window to link to the spreadsheet. how could i do that? and seriously, can there be a more detailed as in steps to take .... i'm new in programming... i can't find any tutorials that start from scratch.
Was This Post Helpful? 0
  • +
  • -

#4 AndyH1963  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 22
  • View blog
  • Posts: 201
  • Joined: 22-June 08

Re: VB in Excel (Form)

Posted 26 June 2008 - 12:42 AM

The code I supplied above is only a template. If the particular subroutine doesn't have any variables then ignore that section of the template.
Was This Post Helpful? 0
  • +
  • -

#5 Kaida  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 34
  • Joined: 19-June 08

Re: VB in Excel (Form)

Posted 26 June 2008 - 09:42 AM

Andy... there's something wrong with the e-mail you gave.. it got bounced back 3 times... can't get thru there.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1