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!
 

Some videos you may like

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

schielrn

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

Watch MrExcel Video

Forum statistics

Threads
1,123,318
Messages
5,600,924
Members
414,416
Latest member
Nobu

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