![]() |
Help needed on program
A friend of mine wrote a program for me that would take 5 rows of numbers and order them in one column with a space in between. Well I would like to change the program so excel would place the numbers in column B, not column A. I don't have much experience with programming, so any help would be appreciated. Here is the code, run it if u please. Thanks much Dim RowNum As Integer Dim ColNum As Integer Dim MoreData As Boolean MoreData = True ColNum = 0 RowNum = 1 CellCount = 0 ColumnCount = 0 TotalColumns = 0 Worksheets("Sheet1").Activate For Each C In Range("A1:IV5") If C.Value < "" Then CellCount = CellCount + 1 End If Next C ColumnCount = CellCount / 5 With Worksheets("Sheet1") For ColNum = 1 To ColumnCount RowNum = RowNum + 6 Range(Cells(1, ColNum), Cells(5, ColNum)).Select Selection.Cut Range(Cells(RowNum, 1), Cells((RowNum + 4), 1)).Select ActiveSheet.Paste Next ColNum End With End Sub -- kingsdynasty ------------------------------------------------------------------------ kingsdynasty's Profile: http://www.excelforum.com/member.php...o&userid=24551 View this thread: http://www.excelforum.com/showthread...hreadid=381461 |
Help needed on program
Try replacing:
Range(Cells(RowNum, 1), Cells((RowNum + 4), 1)).Select with: Range(Cells(RowNum, 2), Cells((RowNum + 4), 2)).Select -- Vasant "kingsdynasty" wrote in message news:kingsdynasty.1r21ep_1119488745.5457@excelforu m-nospam.com... A friend of mine wrote a program for me that would take 5 rows of numbers and order them in one column with a space in between. Well I would like to change the program so excel would place the numbers in column B, not column A. I don't have much experience with programming, so any help would be appreciated. Here is the code, run it if u please. Thanks much Dim RowNum As Integer Dim ColNum As Integer Dim MoreData As Boolean MoreData = True ColNum = 0 RowNum = 1 CellCount = 0 ColumnCount = 0 TotalColumns = 0 Worksheets("Sheet1").Activate For Each C In Range("A1:IV5") If C.Value < "" Then CellCount = CellCount + 1 End If Next C ColumnCount = CellCount / 5 With Worksheets("Sheet1") For ColNum = 1 To ColumnCount RowNum = RowNum + 6 Range(Cells(1, ColNum), Cells(5, ColNum)).Select Selection.Cut Range(Cells(RowNum, 1), Cells((RowNum + 4), 1)).Select ActiveSheet.Paste Next ColNum End With End Sub -- kingsdynasty ------------------------------------------------------------------------ kingsdynasty's Profile: http://www.excelforum.com/member.php...o&userid=24551 View this thread: http://www.excelforum.com/showthread...hreadid=381461 |
All times are GMT +1. The time now is 12:06 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com