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

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

schielrn

Well-known Member
Joined
Apr 4, 2007
Messages
6,941
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.
 

silkworth

Board Regular
Joined
Jan 11, 2008
Messages
91
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.
 

silkworth

Board Regular
Joined
Jan 11, 2008
Messages
91
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!
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,384
Messages
5,836,946
Members
430,464
Latest member
nickburrett

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
Top