LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Call Statement and Return Value

Hi,

I just created a function in a personal macro. I'm trying to use the
Call statement to call my function within my Sub but by doing this, I
loose the return value of the function. I'm looking for a way to use
the return value of the function. Is there an other way to call my
function? A way I can preserve the return value?

Here is my code :

Function SelectRangeToChange(ToChange As Range, X As Range, Value As
String)
Dim Selection As Range, Cell As Range
Set Selection = Intersect(X, ActiveSheet.UsedRange)
For Each Cell In Selection
If (Cell.Value) = "Value" Then
If ToChange Is Nothing Then
Set ToChange = Cell
Else: Set ToChange = Union(ToChange, Cell)
End If
End If
Next Cell
End Function

Sub SarkFundFormat()

Cells.Select
Selection.Sort Key1:=Range("C2"), Header:=xlYes
Dim ToDelete As Range, CashSelection As Range, Cash As String
Call SelectRangeToChange(ToDelete, Range("C:C"), Cash)

- here is my problem. I'm trying to refer to the ToDelete range but I
can't

ToDelete.EntireRow.Copy
Sheets("Cash & FX").Paste
ToDelete.EntireRow.Delete

End Sub

Thanks in advance!

 
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
using a IF statement to return a value Cindy M Excel Worksheet Functions 3 March 26th 10 08:51 PM
using an if then statement call a caption box to a cell ratt[_3_] Excel Programming 2 June 20th 05 05:24 AM
using an if then statement call a caption box to a cell ratt[_2_] Excel Programming 1 June 16th 05 05:30 AM
using an if then statement call a caption box to a cell mangesh_yadav[_325_] Excel Programming 0 June 16th 05 05:02 AM
Can you call a macro as in an IF statement kls[_2_] Excel Programming 2 September 11th 04 10:48 PM


All times are GMT +1. The time now is 08:37 AM.

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

About Us

"It's about Microsoft Excel"