Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default 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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleting Rows With Non-Needed Data between Needed Data Daren Excel Worksheet Functions 2 September 30th 08 06:47 PM
Add-In Program NoodNutt Excel Worksheet Functions 1 August 30th 08 06:59 AM
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 LunaMoon Excel Discussion (Misc queries) 0 July 28th 08 11:03 PM
merging excel program with tdc finance program judy Excel Programming 0 November 5th 03 08:01 PM
Auto Fill Program needed to get maps from internet onto excel Tricia[_2_] Excel Programming 1 July 8th 03 04:25 PM


All times are GMT +1. The time now is 02:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"