Retrieving information to be put into form

mbelleng

New Member
Joined
Sep 21, 2010
Messages
1
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,
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

Forum statistics

Threads
1,214,585
Messages
6,120,397
Members
448,957
Latest member
Hat4Life

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top