PC Review


Reply
Thread Tools Rate Thread

Cell formatting in formula bar but not in cell

 
 
=?Utf-8?B?Y2hlcm1hbg==?=
Guest
Posts: n/a
 
      18th Nov 2006
***This is a repost from yesterday***

I am at my wits end here. I have code from Access that dumps data to an
Excel spreadsheet. Several values in one of my columns are pieces of text
with
Chr(10) between them so that each piece of text falls on a separate line
within the cell.

The text gets dumped, but the separate lines do not show on the sheet in the
cell ( Chr(10) shows in the cell as a little box). However, they do show in
the formula bar as separate lines and if I click in the formula bar or
double-click the cell everything falls into place. I just can’t get this to
happen automatically from code.

Here is the code that sets the value that gets dumped to my sheet. I’m
cycling through a record set in Access, doing a replacement of ";" by Chr(10)
and then setting the cells formula value to the new value. I use a semicolon
as a placeholder to tell my code where I want new lines to start. The
separated parts of text are long strings and separating them to different
lines makes it much easier for my users to read.

NewValue = rs.Fields(iFieldNum - 1)
NewValue = Replace(NewValue, ";", Chr(10))
.Cells(I, iFieldNum).Formula = NewValue

I’ve tried many options to get this to work. Any suggestions would be
greatly appreciated.

Thanks,
Clint
 
Reply With Quote
 
 
 
 
Tom Ogilvy
Guest
Posts: n/a
 
      18th Nov 2006
NewValue = rs.Fields(iFieldNum - 1)
NewValue = Replace(NewValue, ";", Chr(10))
With .Cells(I, iFieldNum)
.Formula = NewValue
.WrapText = True
end with

--
Regards,
Tom Ogilvy


"cherman" <(E-Mail Removed)> wrote in message
newsB710C4B-AC3D-42BE-A1D7-(E-Mail Removed)...
> ***This is a repost from yesterday***
>
> I am at my wits end here. I have code from Access that dumps data to an
> Excel spreadsheet. Several values in one of my columns are pieces of text
> with
> Chr(10) between them so that each piece of text falls on a separate line
> within the cell.
>
> The text gets dumped, but the separate lines do not show on the sheet in
> the
> cell ( Chr(10) shows in the cell as a little box). However, they do show
> in
> the formula bar as separate lines and if I click in the formula bar or
> double-click the cell everything falls into place. I just can't get this
> to
> happen automatically from code.
>
> Here is the code that sets the value that gets dumped to my sheet. I'm
> cycling through a record set in Access, doing a replacement of ";" by
> Chr(10)
> and then setting the cells formula value to the new value. I use a
> semicolon
> as a placeholder to tell my code where I want new lines to start. The
> separated parts of text are long strings and separating them to different
> lines makes it much easier for my users to read.
>
> NewValue = rs.Fields(iFieldNum - 1)
> NewValue = Replace(NewValue, ";", Chr(10))
> .Cells(I, iFieldNum).Formula = NewValue
>
> I've tried many options to get this to work. Any suggestions would be
> greatly appreciated.
>
> Thanks,
> Clint



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Conditional formatting formula for when 1 cell if blank _and_ another cell is not? StargateFanNotAtHome Microsoft Excel Discussion 2 11th Aug 2008 06:08 PM
Cell formatting shows in formula bar but not in cell =?Utf-8?B?Y2hlcm1hbg==?= Microsoft Excel Programming 2 19th Nov 2006 04:34 AM
Formatting a formula within a cell =?Utf-8?B?TmFuY2VlIFZlZQ==?= Microsoft Excel Misc 4 28th Sep 2006 03:49 PM
Question: Cell formula or macro to write result of one cell to another cell Frederik Romanov Microsoft Excel Misc 1 8th Jul 2003 03:03 PM
Question: Cell formula or macro to write result of one cell to another cell Frederik Romanov Microsoft Excel Programming 1 8th Jul 2003 03:03 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:12 PM.