P
PA
Hi everyone,
I had a spreadsheet that was working for the last 3 years without any
problem.
A couple of weeks ago, Excel sent a warning saying that there were
some problem with a file. The error disappeared.
Now suddenly I get the error "File not found: VBA6.DLL" and macros are
not running. I have already saved the file to a new one without macros
and the copy pasted everything and the error continues, I have start a
file from the scratch and start adding the macros, one by one.
Everything was fine till I add the macro below.
This macro does the following: I enter a reference in a form and,
after validation, it pastes the reference in a spreadsheet that
searches all invoices with that reference and then copies the results
back to the form. This macro was working for the last 3 years...
Private Sub GetsaleB_Click()
SheetInUse = ActiveSheet.Name
Application.ScreenUpdating = False
SearchCrit = sale.Reference
If Not IsNumeric(SearchCrit) Then SearchCrit = UCase(SearchCrit)
If IsNumeric(SearchCrit) Then SearchCrit = CDbl(SearchCrit)
Sheets("Getsale").Cells(1, 2).Value = SearchCrit
Call Getsale
If IsError(Sheets("Getsale").Cells(4, 2).Value) Then
MsgBox "Erro"
Sheets("Getsale").Cells(1, 2).Value = 1
Sheets(sheetuse).Select
Application.ScreenUpdating = True
End
End If
With sale
.desc = "Descrição: " & Sheets("Getsale").Cells(5, 2).Value
.ano = "Ano: " & Sheets("Getsale").Cells(4, 2).Value
.valor = "Valor: " & Sheets("Getsale").Cells(2, 2).Value
.metal = "Metal: " & Sheets("Getsale").Cells(3, 2).Value
.stock = "Stock: " & Sheets("Getsale").Cells(5, 14).Value
.customedio = "Custo: " & Round(Sheets("Getsale").Cells(6,
14).Value, 2)
End With
Dim lbtarget As MSForms.ListBox
Dim rngSource As Range
'Set reference to the range of data to be filled
Set rngSource = Worksheets("Getsale").Range("A8:n47")
'Fill the listbox
Set lbtarget = Me.ListBox2
With lbtarget
'Determine number of columns
.ColumnCount = 14
'Set column widths
.ColumnWidths = "50;0;0;0;0;0;50;50;0;50;0;50;50;50;50"
'Insert the range of data supplied
.List = rngSource.Cells.Value
End With
Sheets(sheetuse).Select
Application.ScreenUpdating = True
End Sub
I am using W7 64bits and Excel 2007 32 bits.
Thanks in advance for all the help.
PA
I had a spreadsheet that was working for the last 3 years without any
problem.
A couple of weeks ago, Excel sent a warning saying that there were
some problem with a file. The error disappeared.
Now suddenly I get the error "File not found: VBA6.DLL" and macros are
not running. I have already saved the file to a new one without macros
and the copy pasted everything and the error continues, I have start a
file from the scratch and start adding the macros, one by one.
Everything was fine till I add the macro below.
This macro does the following: I enter a reference in a form and,
after validation, it pastes the reference in a spreadsheet that
searches all invoices with that reference and then copies the results
back to the form. This macro was working for the last 3 years...
Private Sub GetsaleB_Click()
SheetInUse = ActiveSheet.Name
Application.ScreenUpdating = False
SearchCrit = sale.Reference
If Not IsNumeric(SearchCrit) Then SearchCrit = UCase(SearchCrit)
If IsNumeric(SearchCrit) Then SearchCrit = CDbl(SearchCrit)
Sheets("Getsale").Cells(1, 2).Value = SearchCrit
Call Getsale
If IsError(Sheets("Getsale").Cells(4, 2).Value) Then
MsgBox "Erro"
Sheets("Getsale").Cells(1, 2).Value = 1
Sheets(sheetuse).Select
Application.ScreenUpdating = True
End
End If
With sale
.desc = "Descrição: " & Sheets("Getsale").Cells(5, 2).Value
.ano = "Ano: " & Sheets("Getsale").Cells(4, 2).Value
.valor = "Valor: " & Sheets("Getsale").Cells(2, 2).Value
.metal = "Metal: " & Sheets("Getsale").Cells(3, 2).Value
.stock = "Stock: " & Sheets("Getsale").Cells(5, 14).Value
.customedio = "Custo: " & Round(Sheets("Getsale").Cells(6,
14).Value, 2)
End With
Dim lbtarget As MSForms.ListBox
Dim rngSource As Range
'Set reference to the range of data to be filled
Set rngSource = Worksheets("Getsale").Range("A8:n47")
'Fill the listbox
Set lbtarget = Me.ListBox2
With lbtarget
'Determine number of columns
.ColumnCount = 14
'Set column widths
.ColumnWidths = "50;0;0;0;0;0;50;50;0;50;0;50;50;50;50"
'Insert the range of data supplied
.List = rngSource.Cells.Value
End With
Sheets(sheetuse).Select
Application.ScreenUpdating = True
End Sub
I am using W7 64bits and Excel 2007 32 bits.
Thanks in advance for all the help.
PA