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: 921
Default Passing arguments to a module in a Cell

I pass a string from a cell to a module.

Assumming A1 contains the string var 'Procurement'
I execute a Function or Sub based on this
string in cell A1

=PopulateData("Procurement")

However this does not give me the
Range value 'Range("D" & LRow).Value'????

If I change the program to a Subroutine is works

Function PopulateData(var As Variant) As String
Dim ServiceGroup As Variant
Dim SName As String
Dim SDescription As String
Dim LRow As Long
Dim LFound As Boolean

Sheets("Vendor Management").Select
'ServiceGroup = Range("A1").Value
ServiceGroup = var

LFound = False
LRow = 2
Sheets("Input data").Select
GetRng LRow
Do While LFound = False
If Range("D" & LRow).Value = ServiceGroup Then
LFound = True
SName = Range("A" & LRow).Value
SDescription = Range("G" & LRow).Value

Sheets("Service List").Select
Range("B8").Value = SName
Range("B9").Value = SDescription

ElseIf IsEmpty(Range("A" & LRow).Value) = True Then
'MsgBox ("No match was found.")
'Exit Sub
End If
LRow = LRow + 1
Loop
End Function

--
Jeff :-)
 
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
Sub calling and passing arguments Jacob Excel Programming 2 September 28th 06 05:56 PM
Passing arguments from VBA to DLL [email protected] Excel Programming 10 August 18th 06 09:08 AM
passing arguments to events Paul Excel Programming 2 May 24th 06 03:18 PM
Passing Arguments Grant Reid Excel Programming 8 May 24th 04 01:39 PM
Passing arguments to a sub routine... Jeff Harbin[_2_] Excel Programming 2 January 29th 04 03:25 AM


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