Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Using the result of a cell's formula as an argument within a running macro? / More

Hi to AP and All,

The procedure below adds a thick border to the bottom of my varaible
array. I want to replace the fixed range "Range("C13:M14").Select"
with the
variable string returned by my formula in R4 using the same approach as
in:
"ActiveSheet.PageSetup.PrintArea = Range("R5").value"

I'm having a problem to get the syntax right. More help please! /
thanks again! :-)

Range("C13:M14").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Using the result of a cell's formula as an argument within a runni

So if I understand correctly you have a value in R4 such as A1:A10...?
Assuming that to be the case then I would go with something like this...

with Range(Range("R4").value)
.borders.lineslyle = xlNone 'This removes all borders at once
.Borders(xlInsideHorizontal).LineStyle = xlContinuous
.Borders(xlInsideHorizontal).Weight = xlThick
.Borders(xlInsideHorizontal).ColorIndex = xlAutomatic
end with

This all assumes that the value in R4f will be a valid address. If it is
possible that it will not be valid you need to verify that before hand. If
you need help with that then let me know.

--
HTH...

Jim Thomlinson


"Worldman1" wrote:

Hi to AP and All,

The procedure below adds a thick border to the bottom of my varaible
array. I want to replace the fixed range "Range("C13:M14").Select"
with the
variable string returned by my formula in R4 using the same approach as
in:
"ActiveSheet.PageSetup.PrintArea = Range("R5").value"

I'm having a problem to get the syntax right. More help please! /
thanks again! :-)

Range("C13:M14").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
End Sub


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Using the result of a cell's formula as an argument within a runni

Thanks Jim,
That's great, we both understood each other perfectly!

another similar procedure I'm struggling with -

Cell B1 contains a variable cell reference, for example "E:14"
I want to copy contents of cell $E$4 to the cell reference pointed to
in the above

Can't make it work - more help would be appreciated . . .

(where can I find a comprehensive syntax guide?)

Thanks again .

RonW.

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
Function argument correct result but answer 0 in cell? Tonzie Excel Worksheet Functions 3 March 17th 08 01:06 PM
How to return the result of a cell's formula as an argument within a running macro? Worldman1 Excel Programming 4 May 26th 06 06:59 AM
Function (array argument, range argument, string argument) vba Witek[_2_] Excel Programming 3 April 24th 05 03:12 PM
Rephrasing argument for typename and a different result Hari[_3_] Excel Programming 6 June 15th 04 05:14 PM
dynamic arrays as an argument/result in programmed functions AjaxRocks Excel Programming 2 November 24th 03 09:56 PM


All times are GMT +1. The time now is 10:10 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"