Splitting Column in to 2 columns

G

Guest

Hi,

I have a column of values of finance data. ColumnB with 10 values
($10,$20,$30,$40,$50,$60,$70,$80,$90,$100).

User is prompted to select a row of these 10 rows. Suppose user selects
row#5 with $50 value.

How should I copy the values UPTO row#5 of Column B and paste in Column C
without hardcoding?
How should I copy the values AFTER row#5 UPTO row# 10 of Column B and paste
in Column D without hardcoding?

Thanks...Appreciate your help.
 
B

Bob Phillips

Sub Test()
Dim iLastRow As Long
Dim i As Long
Dim EndCell As Range

iLastRow = Cells(Rows.Count, "B").End(xlUp).Row
Set EndCell = Application.InputBox("Select the last cell for column C",
Type:=8)
Range("B1").Resize(EndCell.Row).Copy Range("C1")
EndCell.Offset(1, 0).Resize(iLastRow - EndCell.Row).Copy Range("D1")

End Sub


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top