Well, I have a userform for data entry. There are three areas, with various amounts of data entry points : Log, Layer, and Sample. When I go to change the sample or layer number, the respective information is saved to a worksheet, and then the new information is pulled from the worksheet for the new sample or layer that is selected. When I change the log number, it saves and reloads all three groups of data. This allows me to go back and make changes as needed.
I developed this at home, using Excel 2000, and am trying to use it on 2003 at work. It appeared to run correctly under 2000. Sometimes I get the following error when changing the Log number: Runtime error ‘-2147417848(80010108)’: Method ‘Pastespecial’ of object ‘Range’ Failed
I can click the button a few times, and it works, then the error pops up When I debug, the “Application.Run ("lyrinfo")” line is highlighted in the following code, if it doesnt crash Excel:
The lyrinfo code pulls the information from the worksheet and places it in the layer section of the userform:
ComboBox108 is the layer number. The first row is on row 11.
ComboBox109 is the log number. Each log sheet is 37 rows long.
Any insight on my issues? Your help would be greatly appreciated as I just found out the boss wants to implement this in a day or so. (No real testing to see if my humble programming skills did the job – but go figure)
I developed this at home, using Excel 2000, and am trying to use it on 2003 at work. It appeared to run correctly under 2000. Sometimes I get the following error when changing the Log number: Runtime error ‘-2147417848(80010108)’: Method ‘Pastespecial’ of object ‘Range’ Failed
I can click the button a few times, and it works, then the error pops up When I debug, the “Application.Run ("lyrinfo")” line is highlighted in the following code, if it doesnt crash Excel:
Code:
Private Sub CommandButton101_Click()
'Next LOG - Saves existing sample data then adds one to the sample number list.
Application.Run ("snsave")
Application.Run ("lyrsave")
Application.Run ("logsave")
lastlog = Sheets("List").Range("h51").Value + 1 'row number
numlists = 10 * (lastlog - 1) + 10
numlistss = numlists + 8
Sheets("List").Range("I3:J11").Copy
Sheets("List").Range(Cells(numlists, "i"), Cells(numlistss, "j")).PasteSpecial xlPasteValues
nums = 10 * (lastlog + 1) + 10
numss = nums + 8
Sheets("List").Range(Cells(nums, "i"), Cells(numss, "j")).Copy
Sheets("List").Range("I3:J11").PasteSpecial xlPasteValues
If lastlog = 50 Then
MsgBox "There are to many logs for this file. Please start another file."
Else
Sheets("List").Cells(lastlog + 1, "h") = Sheets("List").Cells(lastlog, "h") + 1
ComboBox109.Value = Sheets("List").Cells(lastlog, "h") + 1
End If
Application.Run ("loginfo")
Application.Run ("lyrinfo")
Application.Run ("sampleinfo")
End Sub
The lyrinfo code pulls the information from the worksheet and places it in the layer section of the userform:
Code:
Sub lyrinfo()
'LAYER NUMBER - RETRIEVES INFORMATION FROM LOG SHEET
r = UserForm1.ComboBox108.Value + 10 + (UserForm1.ComboBox109.Value - 1) * 37
If UserForm1.ComboBox108.Value = 1 Then
UserForm1.From.Value = Sheets("WORKSHEET").Cells(r, 2)
Else
UserForm1.From.Value = Sheets("WORKSHEET").Cells(r - 1, 3)
End If
UserForm1.TextBox200.Value = Sheets("WORKSHEET").Cells(r, 3)
UserForm1.ComboBox100.Value = Sheets("WORKSHEET").Cells(r, 4)
UserForm1.TextBox300.Value = Sheets("WORKSHEET").Cells(r, 6)
End Sub
ComboBox108 is the layer number. The first row is on row 11.
ComboBox109 is the log number. Each log sheet is 37 rows long.
Any insight on my issues? Your help would be greatly appreciated as I just found out the boss wants to implement this in a day or so. (No real testing to see if my humble programming skills did the job – but go figure)