Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Sub calling and passing arguments | Excel Programming | |||
Passing arguments from VBA to DLL | Excel Programming | |||
passing arguments to events | Excel Programming | |||
Passing Arguments | Excel Programming | |||
Passing arguments to a sub routine... | Excel Programming |