School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 307,148 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,731 people online right now. Registration is fast and FREE... Join Now!




Passing a method the proper input in VBA

 

Passing a method the proper input in VBA, Understanding the VBA range object

falcon00

1 Jun, 2009 - 12:00 PM
Post #1

New D.I.C Head
*

Joined: 23 Apr, 2009
Posts: 3

I am trying to invoke a method with the following signature
CODE
order2(ByRef orderRange As Range, ByVal serverCell As String, _
           ByVal extendedAttribColumn As Integer, ByVal fromOrdersPage As Boolean)


Of particular interest is the orderRange variable. I have NO IDEA what VBA wants and all my attempts have failed. I'm trying to work with code that is already written. The way the application functions now is that the user has to select a cell and then the method is called normally with:

CODE
Call OrderFunctions.order2(Selection.rows, serverCell, extAttribColumn, False)


Which is all fine and dandy but I need the method to be called WITHOUT user input. I can't for the life of me understand what exactly selection.rows is! I've played with it and played with it in another list but yahoo is being slow today and I need to knock this out. So far I have:

CODE
Dim theSelection As Range
    Dim serverCell As Range
    Dim extAttribColumn As String
    
    
    Set theSelection = Worksheets("Conditional Orders").Range("A10")
    Set serverCell = Worksheets("Conditional Orders").Range("D5:E5")
    extAttribColumn = 32
    
    Call OrderFunctions.order2(theSelection, serverCell, extAttribColumn, False)
    


But this just gets me a "type mismatch" error. Really helpful! mad.gif

User is offlineProfile CardPM
+Quote Post


falcon00

RE: Passing A Method The Proper Input In VBA

1 Jun, 2009 - 01:14 PM
Post #2

New D.I.C Head
*

Joined: 23 Apr, 2009
Posts: 3

Ok NM. turns out I just needed to be more careful about the data types I was passing in.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/21/09 04:11PM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month