Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Push value to a cell attribute?

Greetings! Am having difficulty imagining an algorithm so am looking for
guidance.

Would like to manipulate the "indent" attribute of a column of cells that
contains text. It would seem that a VBA function is needed, and it would be
fed a target cell absolute location and an indent value. Is this then a
single-cell formula, invoking the function and passing it a target cell
location and an indent value? Is entering the formula with function and
parameters in a cell and then "enter"ing sufficient to cause it to process?
Is there a way to arrange this to make it easy to apply the function to a
column of adjacent cells using drag/copy, perhaps with corresponding columns
of target cell locations and indent values?

Thanks for your ideas!
George


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Push value to a cell attribute?

Hi G,

Try:

'============
Public Sub IndentIt(Rng As Range, indentNum As Long)
Rng.IndentLevel = indentNum
End Sub
'<<============

Use like:

'============
Public Sub TestIt()
IndentIt Range("A1:A10"), 3
End Sub
'<<============

The indenting can be performed from the Format | Cells menu.

---
Regards,
Norman



"G Lykos" wrote in message
...
Greetings! Am having difficulty imagining an algorithm so am looking for
guidance.

Would like to manipulate the "indent" attribute of a column of cells that
contains text. It would seem that a VBA function is needed, and it would
be
fed a target cell absolute location and an indent value. Is this then a
single-cell formula, invoking the function and passing it a target cell
location and an indent value? Is entering the formula with function and
parameters in a cell and then "enter"ing sufficient to cause it to
process?
Is there a way to arrange this to make it easy to apply the function to a
column of adjacent cells using drag/copy, perhaps with corresponding
columns
of target cell locations and indent values?

Thanks for your ideas!
George




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Push value to a cell attribute?

Norman, thanks for the suggestion. How could the range parameter be
(re)defined such that the subroutine would pick up the range value contained
in (for example) an adjacent cell in lieu of a hard-coded parameter? The
interest would be to do a drag/copy after setting up the first formula and
adjacent cell so as to process a column of data.

Thanks again,
George


"Norman Jones" wrote in message
...
Hi G,

Try:

'============
Public Sub IndentIt(Rng As Range, indentNum As Long)
Rng.IndentLevel = indentNum
End Sub
'<<============

Use like:

'============
Public Sub TestIt()
IndentIt Range("A1:A10"), 3
End Sub
'<<============

The indenting can be performed from the Format | Cells menu.

---
Regards,
Norman



"G Lykos" wrote in message
...
Greetings! Am having difficulty imagining an algorithm so am looking

for
guidance.

Would like to manipulate the "indent" attribute of a column of cells

that
contains text. It would seem that a VBA function is needed, and it

would
be
fed a target cell absolute location and an indent value. Is this then a
single-cell formula, invoking the function and passing it a target cell
location and an indent value? Is entering the formula with function and
parameters in a cell and then "enter"ing sufficient to cause it to
process?
Is there a way to arrange this to make it easy to apply the function to

a
column of adjacent cells using drag/copy, perhaps with corresponding
columns
of target cell locations and indent values?

Thanks for your ideas!
George






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Push value to a cell attribute?

Hi George,

A UDF returns a value to the calling cell; it cannot change the format of
another cell or alter its environment.

Consider, instead, assigning the following code to a toolbar button:

'============
Public Sub IndentIt()
On Error Resume Next
Selection.IndentLevel = Selection(1).IndentLevel + 1
On Error GoTo 0
End Sub
'<<============

The above will increase the indent of the selected cells each time the
button is clicked.

If this approach appeals to you, you may wish to assign the following code,
which reduces the indent, to a second button:

'============
Public Sub ReduceIndentIt()

Selection.IndentLevel = _
Application.Max(Selection(1).IndentLevel - 1, 0)

End Sub
'<<============

---
Regards,
Norman



"G Lykos" wrote in message
...
Norman, thanks for the suggestion. How could the range parameter be
(re)defined such that the subroutine would pick up the range value
contained
in (for example) an adjacent cell in lieu of a hard-coded parameter? The
interest would be to do a drag/copy after setting up the first formula and
adjacent cell so as to process a column of data.

Thanks again,
George


"Norman Jones" wrote in message
...
Hi G,

Try:

'============
Public Sub IndentIt(Rng As Range, indentNum As Long)
Rng.IndentLevel = indentNum
End Sub
'<<============

Use like:

'============
Public Sub TestIt()
IndentIt Range("A1:A10"), 3
End Sub
'<<============

The indenting can be performed from the Format | Cells menu.

---
Regards,
Norman



"G Lykos" wrote in message
...
Greetings! Am having difficulty imagining an algorithm so am looking

for
guidance.

Would like to manipulate the "indent" attribute of a column of cells

that
contains text. It would seem that a VBA function is needed, and it

would
be
fed a target cell absolute location and an indent value. Is this then
a
single-cell formula, invoking the function and passing it a target cell
location and an indent value? Is entering the formula with function
and
parameters in a cell and then "enter"ing sufficient to cause it to
process?
Is there a way to arrange this to make it easy to apply the function to

a
column of adjacent cells using drag/copy, perhaps with corresponding
columns
of target cell locations and indent values?

Thanks for your ideas!
George








  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Push value to a cell attribute?

Norman, the suggested Sub does exactly what I was looking for, setting the
indentation of a remote cell. Now, can you please help me adapt it?

1. Can a UDF be used to call the IndentIt Sub (in lieu of TestIt Sub) below?
2. How can the UDF be arranged so as to read the target cell location and
desired indentation from two adjacent cells (e.g. 1 and 2 cells to the right
of the UDF formula cell) and pass them to the Sub?

Thanks again,
George

"Norman Jones" wrote in message
...
Hi G,

Try:

'============
Public Sub IndentIt(Rng As Range, indentNum As Long)
Rng.IndentLevel = indentNum
End Sub
'<<============

Use like:

'============
Public Sub TestIt()
IndentIt Range("A1:A10"), 3
End Sub
'<<============

The indenting can be performed from the Format | Cells menu.

---
Regards,
Norman



"G Lykos" wrote in message
...
Greetings! Am having difficulty imagining an algorithm so am looking

for
guidance.

Would like to manipulate the "indent" attribute of a column of cells

that
contains text. It would seem that a VBA function is needed, and it

would
be
fed a target cell absolute location and an indent value. Is this then a
single-cell formula, invoking the function and passing it a target cell
location and an indent value? Is entering the formula with function and
parameters in a cell and then "enter"ing sufficient to cause it to
process?
Is there a way to arrange this to make it easy to apply the function to

a
column of adjacent cells using drag/copy, perhaps with corresponding
columns
of target cell locations and indent values?

Thanks for your ideas!
George






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
push result from one cell to another Neall Excel Worksheet Functions 2 May 6th 09 03:42 PM
Arrows not moving from cell to cell, when I push arrow columns m Luanne Excel Discussion (Misc queries) 2 December 11th 08 07:24 PM
how to push data to another cell Wawa Excel Worksheet Functions 1 May 31st 07 05:49 PM
Function does not work unless I double click the cell and push ent just me Excel Discussion (Misc queries) 4 March 14th 07 06:32 PM
Caption attribute at Cell in Excel XML dob_xml Excel Discussion (Misc queries) 0 November 27th 06 12:05 PM


All times are GMT +1. The time now is 01:52 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"