LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default Calling Bob Phillips - Please

Bob,

On the 13th Janaury you were kind enough to provide me with a function that
concatenated values across approx 70 columns for a dynamic number of rows.

That code is posted below.

Since then l have been testing the workbook, before releasing it, and have
now found a problem. The user can enter a 3 digit code in any of the 70
columns up to a maximum of 15. Therefore the maximum number of digits that
can be concatenated is 45. However when that number of digits is
concatenated the result ends up as a number raised to a power.(The function
works fine when only 4 or 5 sets of 3 digits are entered)

ie these digits when concatenated

100
101
200
201
203
219
225
300
301
400
401
500
550
600
900

end up being displayed as

100101200201203000000000000000000000000000000

and the value displayed in the formula bar is

1.00101200201203E+44

what l really need to see is a string as follows

100101200201203219225300301400401500550600

because in the next 15 columns l extract each of the 3 digit codes using
functions (for example Left(A1,3) Mid(A1,4,3) etc)

Any ideas as to whats going wrong and what the solution is please?

Alternatively is it possible to 'loop thru' each of the 70 columns and when
the 1st 3 digit value is found put it into say column 100, the 2nd 3 digit
value in column 101 etc for each row in the dynamic range?

xxxxxxxxx Code posted in January xxxxxxxxxxxxxxxxxx

This works from row 1 to the last row and concatenates values from column 2
out, and drop the result in column A. Change to suit

Sub ConcatenateRange()
Dim val As String
Dim iLastRow As Long
Dim iLastCol As Long
Dim i As Long
Dim j As Long
iLastRow = Cells.Find(What:="*", _
After:=Range("A1"), _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).Row
For i = 1 To iLastRow
iLastCol = Cells(i, Columns.Count).End(xlToLeft).Column
val = ""
For j = 2 To iLastCol
val = val & Cells(i, j)
Next j
Cells(i, "A").Value = val
Next i
End Sub

Kind regards

Michael Beckinsale


 
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
to Bob Phillips Jack Sons Excel Discussion (Misc queries) 15 August 28th 07 02:51 PM
For Bob Phillips D.J.Shaw Excel Worksheet Functions 5 August 3rd 05 01:20 AM
Bob Phillips Tom Ogilvy Excel Programming 0 August 6th 04 03:19 PM
To: Bob Phillips Metallo[_4_] Excel Programming 3 July 14th 04 07:43 PM
Bob phillips?? gav meredith[_2_] Excel Programming 1 April 20th 04 01:41 PM


All times are GMT +1. The time now is 09:18 AM.

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

About Us

"It's about Microsoft Excel"