View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Stuart[_5_] Stuart[_5_] is offline
external usenet poster
 
Posts: 413
Default Change user's data problem

Just a little more information:

All sheets 'appear' to have the full data copied (the
array holds the all the elements correctly) and
Transferdata equals all the data. That much is consistent.

The first sheet wraptext's correctly and all the data is
correctly pasted, except that virtually every colB cell
where a paste has occurred has an extra line (empty).

In sheets 2 onwards, the pasted colB cells contain only
one line of text (even though the cell is enabled for
wraptext) and the rowheight is unchanged (12.75).

I can manually edit these sheets, changing rowheights
where neccessary, such that the data will eventually
display correctly.

Any ideas, please?

Regards.

"Trevor Shuttleworth" wrote in message
...
Stuart

Lose the .value on the two lines

Dim dataStr(1 To 5)
dataStr(1) = "a"
dataStr(2) = "b"
dataStr(3) = "c"
dataStr(4) = "d"
dataStr(5) = "e"

For i = 1 To UBound(dataStr)
If i = 1 Then
Transferdata = dataStr(i)
Else
Transferdata = Transferdata & " " & dataStr(i)
End If
Next
MsgBox Transferdata

Regards

Trevor


"Stuart" wrote in message
...
Nearly there, I think.
I've built an array whereby the elements contain
the cell contents of B10 and B11, but cannot seem
to combine the elements back into a single string

Here is the code, which gives 'object required' on
the line......Transferdata etc (dimmed as string)

For i = 1 To UBound(dataStr)
If i = 1 Then
Transferdata = dataStr(i).Value
Else
Transferdata = Transferdata & " " & dataStr(i).Value
End If
Next

Tried using Join, but cannot make that work either.

Regards.

"Trevor Shuttleworth" wrote in message
...
Stuart

that would work. The only other suggestion would be to build the cell

in
a
variable, reformat the cell with Wrap Text and drop the contents of

the
variable into the cell. In your example, build the variable from the
contents of B5 to B8, reformat B5 with Wrap Text and copy the variable
contents to B5. Delete rows 6 to 8. As always, when you are deleting

rows
it's probably easiest to work up from the bottom of the data.

One concern would be that if the user had created "short" entries in

the
cells B5 to B8, when they are combined into one cell with Wrap Text

they
may
only generate 3 lines rather than the original 4 which could screw up

your
formatting. Just a thought. Maybe you need to include a new line

character
to force the same number of rows?

Regards

Trevor


"Stuart" wrote in message
...
Hit Send too early.
Meant to add that I was thinking of the following:

Establish the start and end row of a record (say the
record is "A5:G8")
Then insert a row into "A9" and format "B9" with
WrapText enabled.
Then copy the record into "A9" and delete "A5:G8".
A few rows short, but the wraptext will compensate
for that.

Is there a better way, please?

Regards.

"Stuart" wrote in message
...
I have a rogue user workbook ( a one-off, I hope)
such that current code will not run completely
successfully on it.

Rather than adapt the code for this one instance, I
wonder if there is a way to alter the data?

Row
1 A Data....................
2 Data......................
3 Data..........................
4
5 B Data..........................
Data....................................

What this user has done, is to type data into
individual rows in col B, rather than use wraptext.

What I'd like to do is to loop through the records
(there's always at least one empty row between
records) and change the data to the way it would
have been created with wraptext enabled in Col B.

Is that possible, please?

Regards.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.515 / Virus Database: 313 - Release Date: 01/09/2003




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.515 / Virus Database: 313 - Release Date: 01/09/2003






---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.515 / Virus Database: 313 - Release Date: 01/09/2003






---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.515 / Virus Database: 313 - Release Date: 01/09/2003