PC Review


Reply
Thread Tools Rate Thread

Adding a scroll bar to a cell to scroll its contents.

 
 
=?Utf-8?B?U2t5S2lk?=
Guest
Posts: n/a
 
      7th Aug 2007
Is that possible? I have many cells with a sepcific height. If the
contents of the cell exceed the height I would want a scrollbar to appear for
the cell....

Or does anyone have an alternative solution to this?
 
Reply With Quote
 
 
 
 
Bernard Liengme
Guest
Posts: n/a
 
      7th Aug 2007
Sorry, no can do.
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
www.stfx.ca/people/bliengme
remove caps from email

"SkyKid" <(E-Mail Removed)> wrote in message
news:9EBFE755-3441-4255-AF53-(E-Mail Removed)...
> Is that possible? I have many cells with a sepcific height. If the
> contents of the cell exceed the height I would want a scrollbar to appear
> for
> the cell....
>
> Or does anyone have an alternative solution to this?



 
Reply With Quote
 
=?Utf-8?B?VmVyZ2VsIEFkcmlhbm8=?=
Guest
Posts: n/a
 
      7th Aug 2007
This might be a very crude solution but maybe it would give you an idea.

Add a textbox to the worksheet and name it as TextBox1. Then paste this
code in the worksheet code module:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Target.Cells.Count > 1 Then Exit Sub

TextBox1.Left = Target.Left
TextBox1.Top = Target.Top
TextBox1.Width = Target.Width
TextBox1.Height = Target.Height
TextBox1.MultiLine = True
TextBox1.ScrollBars = fmScrollBarsVertical
TextBox1.LinkedCell = Target.Address

End Sub





--
Hope that helps.

Vergel Adriano


"SkyKid" wrote:

> Is that possible? I have many cells with a sepcific height. If the
> contents of the cell exceed the height I would want a scrollbar to appear for
> the cell....
>
> Or does anyone have an alternative solution to this?

 
Reply With Quote
 
=?Utf-8?B?VmVyZ2VsIEFkcmlhbm8=?=
Guest
Posts: n/a
 
      7th Aug 2007
This might be a very crude solution but maybe it would give you an idea.

Add a textbox to the worksheet and name it as TextBox1. Then paste this
code in the worksheet code module:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Target.Cells.Count > 1 Then Exit Sub

TextBox1.Left = Target.Left
TextBox1.Top = Target.Top
TextBox1.Width = Target.Width
TextBox1.Height = Target.Height
TextBox1.MultiLine = True
TextBox1.ScrollBars = fmScrollBarsVertical
TextBox1.LinkedCell = Target.Address

End Sub





--
Hope that helps.

Vergel Adriano


"SkyKid" wrote:

> Is that possible? I have many cells with a sepcific height. If the
> contents of the cell exceed the height I would want a scrollbar to appear for
> the cell....
>
> Or does anyone have an alternative solution to this?

 
Reply With Quote
 
=?Utf-8?B?U2t5S2lk?=
Guest
Posts: n/a
 
      7th Aug 2007
That sounds like a good idea.... I didnt even t hink about using text
boxes...thanks

"Vergel Adriano" wrote:

> This might be a very crude solution but maybe it would give you an idea.
>
> Add a textbox to the worksheet and name it as TextBox1. Then paste this
> code in the worksheet code module:
>
> Private Sub Worksheet_SelectionChange(ByVal Target As Range)
>
> If Target.Cells.Count > 1 Then Exit Sub
>
> TextBox1.Left = Target.Left
> TextBox1.Top = Target.Top
> TextBox1.Width = Target.Width
> TextBox1.Height = Target.Height
> TextBox1.MultiLine = True
> TextBox1.ScrollBars = fmScrollBarsVertical
> TextBox1.LinkedCell = Target.Address
>
> End Sub
>
>
>
>
>
> --
> Hope that helps.
>
> Vergel Adriano
>
>
> "SkyKid" wrote:
>
> > Is that possible? I have many cells with a sepcific height. If the
> > contents of the cell exceed the height I would want a scrollbar to appear for
> > the cell....
> >
> > Or does anyone have an alternative solution to this?

 
Reply With Quote
 
=?Utf-8?B?U2t5S2lk?=
Guest
Posts: n/a
 
      7th Aug 2007
How would that idea work in C#? I'm having some issues trying to find where
the multiline and scrollbars properties for a text box exist in C#

"SkyKid" wrote:

> That sounds like a good idea.... I didnt even t hink about using text
> boxes...thanks
>
> "Vergel Adriano" wrote:
>
> > This might be a very crude solution but maybe it would give you an idea.
> >
> > Add a textbox to the worksheet and name it as TextBox1. Then paste this
> > code in the worksheet code module:
> >
> > Private Sub Worksheet_SelectionChange(ByVal Target As Range)
> >
> > If Target.Cells.Count > 1 Then Exit Sub
> >
> > TextBox1.Left = Target.Left
> > TextBox1.Top = Target.Top
> > TextBox1.Width = Target.Width
> > TextBox1.Height = Target.Height
> > TextBox1.MultiLine = True
> > TextBox1.ScrollBars = fmScrollBarsVertical
> > TextBox1.LinkedCell = Target.Address
> >
> > End Sub
> >
> >
> >
> >
> >
> > --
> > Hope that helps.
> >
> > Vergel Adriano
> >
> >
> > "SkyKid" wrote:
> >
> > > Is that possible? I have many cells with a sepcific height. If the
> > > contents of the cell exceed the height I would want a scrollbar to appear for
> > > the cell....
> > >
> > > Or does anyone have an alternative solution to this?

 
Reply With Quote
 
=?Utf-8?B?VmVyZ2VsIEFkcmlhbm8=?=
Guest
Posts: n/a
 
      7th Aug 2007
I'm not familiar with C#, but in VB (and VBA), I am able to access the
TextBox directly as an object inside the worksheet. I assume it would be
similar in C#.

Here's how I would do it in VB. I replaced fmScrollBarsVertical with it's
integer value of 2.


Dim xlApp As New Excel.Application
Dim xlWb As Excel.Workbook
xlWb = xlApp.Workbooks.Open("C:\TEMP\Sample.xls")

With xlWb.Sheets("Sheet1")
.TextBox1.MultiLine = True
.TextBox1.ScrollBars = 2 'fmScrollBarsVertical
MsgBox(.textbox1.text)
End With

xlWb.Close(False)
xlApp.Quit()



--
Hope that helps.

Vergel Adriano


"SkyKid" wrote:

> How would that idea work in C#? I'm having some issues trying to find where
> the multiline and scrollbars properties for a text box exist in C#
>
> "SkyKid" wrote:
>
> > That sounds like a good idea.... I didnt even t hink about using text
> > boxes...thanks
> >
> > "Vergel Adriano" wrote:
> >
> > > This might be a very crude solution but maybe it would give you an idea.
> > >
> > > Add a textbox to the worksheet and name it as TextBox1. Then paste this
> > > code in the worksheet code module:
> > >
> > > Private Sub Worksheet_SelectionChange(ByVal Target As Range)
> > >
> > > If Target.Cells.Count > 1 Then Exit Sub
> > >
> > > TextBox1.Left = Target.Left
> > > TextBox1.Top = Target.Top
> > > TextBox1.Width = Target.Width
> > > TextBox1.Height = Target.Height
> > > TextBox1.MultiLine = True
> > > TextBox1.ScrollBars = fmScrollBarsVertical
> > > TextBox1.LinkedCell = Target.Address
> > >
> > > End Sub
> > >
> > >
> > >
> > >
> > >
> > > --
> > > Hope that helps.
> > >
> > > Vergel Adriano
> > >
> > >
> > > "SkyKid" wrote:
> > >
> > > > Is that possible? I have many cells with a sepcific height. If the
> > > > contents of the cell exceed the height I would want a scrollbar to appear for
> > > > the cell....
> > > >
> > > > Or does anyone have an alternative solution to this?

 
Reply With Quote
 
=?Utf-8?B?VmVyZ2VsIEFkcmlhbm8=?=
Guest
Posts: n/a
 
      7th Aug 2007
by the way, this works with the assumption that the workbook already has a
textbox control named "TextBox1"....


--
Hope that helps.

Vergel Adriano


"Vergel Adriano" wrote:

> I'm not familiar with C#, but in VB (and VBA), I am able to access the
> TextBox directly as an object inside the worksheet. I assume it would be
> similar in C#.
>
> Here's how I would do it in VB. I replaced fmScrollBarsVertical with it's
> integer value of 2.
>
>
> Dim xlApp As New Excel.Application
> Dim xlWb As Excel.Workbook
> xlWb = xlApp.Workbooks.Open("C:\TEMP\Sample.xls")
>
> With xlWb.Sheets("Sheet1")
> .TextBox1.MultiLine = True
> .TextBox1.ScrollBars = 2 'fmScrollBarsVertical
> MsgBox(.textbox1.text)
> End With
>
> xlWb.Close(False)
> xlApp.Quit()
>
>
>
> --
> Hope that helps.
>
> Vergel Adriano
>
>
> "SkyKid" wrote:
>
> > How would that idea work in C#? I'm having some issues trying to find where
> > the multiline and scrollbars properties for a text box exist in C#
> >
> > "SkyKid" wrote:
> >
> > > That sounds like a good idea.... I didnt even t hink about using text
> > > boxes...thanks
> > >
> > > "Vergel Adriano" wrote:
> > >
> > > > This might be a very crude solution but maybe it would give you an idea.
> > > >
> > > > Add a textbox to the worksheet and name it as TextBox1. Then paste this
> > > > code in the worksheet code module:
> > > >
> > > > Private Sub Worksheet_SelectionChange(ByVal Target As Range)
> > > >
> > > > If Target.Cells.Count > 1 Then Exit Sub
> > > >
> > > > TextBox1.Left = Target.Left
> > > > TextBox1.Top = Target.Top
> > > > TextBox1.Width = Target.Width
> > > > TextBox1.Height = Target.Height
> > > > TextBox1.MultiLine = True
> > > > TextBox1.ScrollBars = fmScrollBarsVertical
> > > > TextBox1.LinkedCell = Target.Address
> > > >
> > > > End Sub
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Hope that helps.
> > > >
> > > > Vergel Adriano
> > > >
> > > >
> > > > "SkyKid" wrote:
> > > >
> > > > > Is that possible? I have many cells with a sepcific height. If the
> > > > > contents of the cell exceed the height I would want a scrollbar to appear for
> > > > > the cell....
> > > > >
> > > > > Or does anyone have an alternative solution to this?

 
Reply With Quote
 
=?Utf-8?B?bHdpZGpheWE=?=
Guest
Posts: n/a
 
      17th Oct 2007
Hi,
I have the same problem. I tried to use your code but I don't know how to
link it to the cell. Can we link this code to a specific cell?
Thanks.

"Vergel Adriano" wrote:

> This might be a very crude solution but maybe it would give you an idea.
>
> Add a textbox to the worksheet and name it as TextBox1. Then paste this
> code in the worksheet code module:
>
> Private Sub Worksheet_SelectionChange(ByVal Target As Range)
>
> If Target.Cells.Count > 1 Then Exit Sub
>
> TextBox1.Left = Target.Left
> TextBox1.Top = Target.Top
> TextBox1.Width = Target.Width
> TextBox1.Height = Target.Height
> TextBox1.MultiLine = True
> TextBox1.ScrollBars = fmScrollBarsVertical
> TextBox1.LinkedCell = Target.Address
>
> End Sub
>
>
>
>
>
> --
> Hope that helps.
>
> Vergel Adriano
>
>
> "SkyKid" wrote:
>
> > Is that possible? I have many cells with a sepcific height. If the
> > contents of the cell exceed the height I would want a scrollbar to appear for
> > the cell....
> >
> > Or does anyone have an alternative solution to this?

 
Reply With Quote
 
=?Utf-8?B?bHdpZGpheWE=?=
Guest
Posts: n/a
 
      17th Oct 2007
Hi, disregard my previous question. I was such a dummy. :P

"lwidjaya" wrote:

> Hi,
> I have the same problem. I tried to use your code but I don't know how to
> link it to the cell. Can we link this code to a specific cell?
> Thanks.
>
> "Vergel Adriano" wrote:
>
> > This might be a very crude solution but maybe it would give you an idea.
> >
> > Add a textbox to the worksheet and name it as TextBox1. Then paste this
> > code in the worksheet code module:
> >
> > Private Sub Worksheet_SelectionChange(ByVal Target As Range)
> >
> > If Target.Cells.Count > 1 Then Exit Sub
> >
> > TextBox1.Left = Target.Left
> > TextBox1.Top = Target.Top
> > TextBox1.Width = Target.Width
> > TextBox1.Height = Target.Height
> > TextBox1.MultiLine = True
> > TextBox1.ScrollBars = fmScrollBarsVertical
> > TextBox1.LinkedCell = Target.Address
> >
> > End Sub
> >
> >
> >
> >
> >
> > --
> > Hope that helps.
> >
> > Vergel Adriano
> >
> >
> > "SkyKid" wrote:
> >
> > > Is that possible? I have many cells with a sepcific height. If the
> > > contents of the cell exceed the height I would want a scrollbar to appear for
> > > the cell....
> > >
> > > Or does anyone have an alternative solution to this?

 
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
How do I put a scroll bar within a cell to change its contents? kerry4477 Microsoft Excel Misc 1 29th Apr 2008 08:09 PM
adding scroll bar to scroll on cell's content? =?Utf-8?B?Um90ZW0=?= Microsoft Excel Charting 0 16th Nov 2006 12:36 PM
Vertical Scroll problems - won't scroll back up to show first record in cont form Sierras Microsoft Access Forms 2 26th May 2006 01:19 PM
Cell Contents controlled via a scroll bar =?Utf-8?B?QUs=?= Microsoft Excel Programming 1 20th Apr 2005 06:58 PM
Adding a scroll bar to a cell Sonars_UK Microsoft Frontpage 4 5th May 2004 12:59 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:20 AM.