ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Splitting Column in to 2 columns (https://www.excelbanter.com/excel-discussion-misc-queries/109514-splitting-column-2-columns.html)

Dimri

Splitting Column in to 2 columns
 
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.


Bob Phillips

Splitting Column in to 2 columns
 
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)

"Dimri" wrote in message
...
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.





All times are GMT +1. The time now is 04:58 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com