Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Deleting Rows With Non-Needed Data between Needed Data | Excel Worksheet Functions | |||
Add-In Program | Excel Worksheet Functions | |||
Is there a way to unload the loaded XLL file in Excel? Hi all, I amdebugging XLL link library using Visual C++. Everytime I rebuild the XLL, Ihave to close the whole Excel program and relaunch the Excel program again,and then load in the newly gene | Excel Discussion (Misc queries) | |||
merging excel program with tdc finance program | Excel Programming | |||
Auto Fill Program needed to get maps from internet onto excel | Excel Programming |