Hello,
I am a novice in terms of Excel and VB and am trying to make a macro retrieve information from a particular line in one worksheet and insert it into the appropriate cells in the form worksheet. Currently I am using the
following and it works but after having used it for 234 lines, you can imagine that the sub has become too long to run:
RespLine = InputBox("Please enter the line number you would like to retrieve:")
If RespLine = "" Then Exit Sub
RespLine = Int(RespLine)
If RespLine = 1 Then
MsgBox "Line number must be greater than 1", vbOKOnly
Sheets("New Hire").Select
Exit Sub
End If
ActiveWindow.WindowState = xlMinimized
Sheets("DATABASE FOR MERGE").Select
Cells(RespLine, 1).Select
Selection.Copy
Sheets("New Hire").Select
Range("B5").Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Sheets("DATABASE FOR MERGE").Select
Cells(RespLine, 2).Select
Application.CutCopyMode = False
Selection.Copy
Sheets("New Hire").Select
Range("B4").Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Most of the information to be put back is in continuous cells, such as lines 24 to 36 go into cells B15 to B27. Is there a more efficient way to do this retrieve?
Please help! Thank you,
I am a novice in terms of Excel and VB and am trying to make a macro retrieve information from a particular line in one worksheet and insert it into the appropriate cells in the form worksheet. Currently I am using the
following and it works but after having used it for 234 lines, you can imagine that the sub has become too long to run:
RespLine = InputBox("Please enter the line number you would like to retrieve:")
If RespLine = "" Then Exit Sub
RespLine = Int(RespLine)
If RespLine = 1 Then
MsgBox "Line number must be greater than 1", vbOKOnly
Sheets("New Hire").Select
Exit Sub
End If
ActiveWindow.WindowState = xlMinimized
Sheets("DATABASE FOR MERGE").Select
Cells(RespLine, 1).Select
Selection.Copy
Sheets("New Hire").Select
Range("B5").Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Sheets("DATABASE FOR MERGE").Select
Cells(RespLine, 2).Select
Application.CutCopyMode = False
Selection.Copy
Sheets("New Hire").Select
Range("B4").Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Most of the information to be put back is in continuous cells, such as lines 24 to 36 go into cells B15 to B27. Is there a more efficient way to do this retrieve?
Please help! Thank you,