Sub Translate()
'checks to see if the workbook has the appropriate amount of sheets
If Sheets.Count <> "6" Then GoTo diffsheetserror
'let's get the worksheet names -- because I don't know the object variable for the below section to work properly.
ActiveWorkbook.Sheets(1).Select
sheett1 = ActiveSheet.Name
ActiveWorkbook.Sheets(2).Select
sheett2 = ActiveSheet.Name
ActiveWorkbook.Sheets(3).Select
sheett3 = ActiveSheet.Name
ActiveWorkbook.Sheets(4).Select
sheett4 = ActiveSheet.Name
ActiveWorkbook.Sheets(5).Select
sheett5 = ActiveSheet.Name
ActiveWorkbook.Sheets(6).Select
sheett6 = ActiveSheet.Name
'we gonna ask to see which sheet needs to be translated, users should only pick one of the ones that says original.
prelimorfinal = Application.InputBox _
(Prompt:="Which sheet would you like to process? (Pick one of the 'Translated' sheets)" & vbNewLine & _
"1 - " & sheett1 & vbNewLine & _
"2 - " & sheett2 & vbNewLine & _
"3 - " & sheett3 & vbNewLine & _
"4 - " & sheett4 & vbNewLine & _
"5 - " & sheett5 & vbNewLine & _
"6 - " & sheett6 & vbNewLine & _
vbNewLine & _
"Please insert a line number that corresponds with a worksheet.", Title:="Which sheet?", Type:=1)
On Error GoTo errnoentry
Application.DisplayAlerts = True
'now we have selected which sheet we will translate
'switching to the sheet we selected for translation
ActiveWorkbook.Worksheets(prelimorfinal).Range("A1").Select
'checks for *APPROPRIATE* data in the selected sheet...
lencheck = Application.Len("A1")
If lencheck = "1360" Then GoTo nextline
If lencheck = "38" Then GoTo nextline
If lencheck = "263" Then GoTo nextline
If lencheck = "43" Then GoTo nextline
If lencheck = "19" Then GoTo nextline
GoTo inappropriatedatafromlencheck
nextline:
'Prior to these lines, we need to have selected the correct sheet.
ToDMPfromDOH:
Range("A1").Select
Application.CutCopyMode = False
Selection.TextToColumns Destination:=Range("A4"), DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 1), Array(8, 1), Array(38, 1), Array(68, 1), Array(76, 1), _
Array(136, 1), Array(137, 1), Array(145, 1), Array(153, 1), Array(193, 1), Array(204, 1), _
Array(281, 1), Array(321, 1), Array(361, 1), Array(363, 1), Array(372, 1), Array(382, 1), _
Array(390, 1), Array(397, 1), Array(403, 1), Array(409, 1), Array(415, 1), Array(423, 1), _
Array(463, 1), Array(503, 1), Array(543, 1), Array(583, 1), Array(585, 1), Array(594, 1), _
Array(604, 1), Array(612, 1), Array(652, 1), Array(692, 1), Array(732, 1), Array(772, 1), _
Array(774, 1), Array(783, 1), Array(793, 1), Array(801, 1), Array(841, 1), Array(881, 1), _
Array(921, 1), Array(961, 1), Array(963, 1), Array(972, 1), Array(982, 1), Array(990, 1), _
Array(1030, 1), Array(1070, 1), Array(1110, 1), Array(1150, 1), Array(1152, 1), Array(1161, 1), _
Array(1171, 1), Array(1179, 1), Array(1219, 1), Array(1259, 1), Array(1299, 1), Array(1339, 1), _
Array(1341, 1), Array(1350, 1), Array(1360, 1)), TrailingMinusNumbers:=True
GoTo nextline
ErrorReport:
Range("A1").Select
Application.CutCopyMode = False
Selection.TextToColumns Destination:=Range("A4"), DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 1), Array(6, 1), Array(7, 1), Array(15, 1), Array(23, 1), _
Array(26, 1), Array(29, 1), Array(32, 1), Array(35, 1), Array(38, 1)), TrailingMinusNumbers:=True
GoTo nextline
Addchange:
Range("A1").Select
Application.CutCopyMode = False
Selection.TextToColumns Destination:=Range("A4"), DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 1), Array(1, 1), Array(9, 1), Array(17, 1), Array(18, 1), _
Array(26, 1), Array(34, 1), Array(35, 1), Array(43, 1), Array(51, 1), Array(59, 1), _
Array(60, 1), Array(61, 1), Array(62, 1), Array(64, 1), Array(72, 1), Array(80, 1), _
Array(88, 1), Array(96, 1), Array(104, 1), Array(112, 1), Array(152, 1), Array(192, 1), _
Array(232, 1), Array(234, 1), Array(243, 1), Array(253, 1), Array(263, 1)), TrailingMinusNumbers:=True
GoTo nextline
Deleterecord:
Range("A1").Select
Application.CutCopyMode = False
Selection.TextToColumns Destination:=Range("A4"), DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 1), Array(1, 1), Array(9, 1), Array(17, 1), Array(25, 1), _
Array(33, 1), Array(41, 1), Array(42, 1), Array(43, 1)), TrailingMinusNumbers:=True
GoTo nextline
Rejectionrecord:
Range("A1").Select
Application.CutCopyMode = False
Selection.TextToColumns Destination:=Range("A4"), DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 1), Array(1, 1), Array(9, 1), Array(11, 1), Array(19, 1)), TrailingMinusNumbers:=True
GoTo nextline
End Sub
I'm still writing code so technically the code changes every minute. :P -- oh and I don't anticipate the lower sections working yet, I didn't get a chance to debug them. So please nobody bother correcting that stuff, I probably will be able to. It's just the not-appearing input box that is halting my correction process
Bookmarks