Consulting

Results 1 to 4 of 4

Thread: vba help on declaring varible

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Banned VBAX Contributor
    Joined
    Aug 2017
    Posts
    144
    Location

    vba help on declaring varible


    Hi Team,

    I am new in vba , learning it, I have a question, my below macro works give the result.
    But if I write variable in between Parenthesis , my macro didn't work. like
    Sub test(dim i as integer)

    Below macro works.


    Sub test()
    Dim i As Long
    For i = 1 To 10
        Range("a" & i).Value = i
    Next i
    End Sub
    This didn't work.

    Sub test(i As Long)
    
    For i = 1 To 10
        Range("a" & i).Value = i
    Next i
    End Sub
    On google I come across coding like as below?.... So which scenerio we have to declare
    variable like the below One. Thanks in advance!

    Sub QuickSort(coll As Collection, first As Long, last As Long
    Last edited by SamT; 01-14-2018 at 02:42 PM. Reason: Corrected Code Format tag placement

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •