Macro not running when it is supposed too

  • Thread starter Thread starter garth.kirkwood
  • Start date Start date
G

garth.kirkwood

I have a problem in that I have a Command button that hides a form and
then calls an external (still same workbook) function, except it
doesn't run the external function.

When I step through the function it works fine. It doesn't work if I
step from the call to the function and when the function is
highlighted I tell it to run it doesn't work either.

The thing is that the programming works fine on my computer, it is
only when I go to show the user that it doesn't work properly.

I have checked and the Macro has the same references and the exact
same version of excel.

Any thoughts?

Thanks

Girkers
 
Can you post the code?
--
JNW









- Show quoted text -

Command button code:

Private Sub cmd_Finish_Click()

Me.Hide
Move_Data

End Sub

Other function:

Public Sub Move_Data()
On Error GoTo Err_Error_State

Application.ScreenUpdating = False
Dim wbkInstance
Dim strCurrentPath
Dim intCount As Integer
Dim booInserted As Boolean

booInserted = False

Worksheets("Sheet1").Range("All_Data").Copy
strCurrentPath = ActiveWorkbook.Path
Workbooks.Open strCurrentPath & "\QLDONSHOW.xls", , False, , , ,
True, , , True, , , False, True
intCount =
Workbooks("QLDONSHOW.xls").Worksheets("Sheet1").Range("Count").Value +
1
Do While booInserted = False

With Workbooks("QLDONSHOW.xls").Worksheets("Sheet1")
.Range("Start").Offset(intCount, 0).Select
If IsEmpty(ActiveCell) Then
.Paste
booInserted = True
Else
intCount = intCount + 1
End If
.Range("Count").Value = intCount
End With

Loop
Workbooks("QLDONSHOW.xls").Close True

Initialise_Form

Exit_Sub:
Exit Sub

Err_Error_State:
Application.ScreenUpdating = True
Resume Exit_Sub

End Sub
 
Command button code:

Private Sub cmd_Finish_Click()

Me.Hide
Move_Data

End Sub

Other function:

Public Sub Move_Data()
On Error GoTo Err_Error_State

Application.ScreenUpdating = False
Dim wbkInstance
Dim strCurrentPath
Dim intCount As Integer
Dim booInserted As Boolean

booInserted = False

Worksheets("Sheet1").Range("All_Data").Copy
strCurrentPath = ActiveWorkbook.Path
Workbooks.Open strCurrentPath & "\QLDONSHOW.xls", , False, , , ,
True, , , True, , , False, True
intCount =
Workbooks("QLDONSHOW.xls").Worksheets("Sheet1").Range("Count").Value +
1
Do While booInserted = False

With Workbooks("QLDONSHOW.xls").Worksheets("Sheet1")
.Range("Start").Offset(intCount, 0).Select
If IsEmpty(ActiveCell) Then
.Paste
booInserted = True
Else
intCount = intCount + 1
End If
.Range("Count").Value = intCount
End With

Loop
Workbooks("QLDONSHOW.xls").Close True

Initialise_Form

Exit_Sub:
Exit Sub

Err_Error_State:
Application.ScreenUpdating = True
Resume Exit_Sub

End Sub- Hide quoted text -

- Show quoted text -

Anyone else come across this problem?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top