entire cell contents not getting into string array...

silkworth

Board Regular
Joined
Jan 11, 2008
Messages
91
Hi All,

I've got some code, part of a much larger macro, that is supposed to read some cells into an array to save them (while they are deleted and replaced later). The contents are text (multiple words), but only the first word makes it into the array. What's the problem?

FirstTempCell is a variant that is set by a Find() before this snippet:

Code:
                For j = 0 To 10
                    Headers(j) = Cells(FirstTempCell.Row, FirstTempCell.Column + j).Value
                    MsgBox Headers(j)
                Next j

Thanks!
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Are the words you are trying to add actually accross columns? Just want to make sure as you are incrementing the column counter. Your not receiving any errors are you? If not then I assume you ahve declared your array large enough.
 
Upvote 0
Yes, they are actually in separate columns - originally not, I use TextToColumns to explode them from copied-in csv data, but I looked at the data after TextToColumns but before the above code, and they're definitely properly split up. Seems like it's seeing the space and recognizing that as the end of the contents or something.
 
Upvote 0
Ah...nevermind...I found my problem. An errant " *" in a search and replace just before this code was deleting all but the first words...d'oh!
 
Upvote 0

Forum statistics

Threads
1,214,924
Messages
6,122,293
Members
449,077
Latest member
Rkmenon

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top