Results 1 to 4 of 4

How to loop with a String Variable

Threaded View

  1. #1
    Registered User
    Join Date
    06-19-2007
    Posts
    6

    Expert Needed: How to loop Need Help With String Variable

    Expert Needed: How do you in a loop or with an array go from

    
        Dim Variable1 As String
        Call ibrd(udDevice, Variable1)
        Dim VariableDbl1 As Double
        VariableDbl1 = CDbl(Variable1)
        
        'display response in appropriate cell
        Worksheets("Temp1").Range("F53").value = VariableDbl1
    to this, without copying and pasting and changing variable1..2..3.4..5
    
        Dim Variable2 As String
        Call ibrd(udDevice, Variable2)
        Dim VariableDbl2 As Double
        VariableDbl2= CDbl(Variable2)
        
        'display response in appropriate cell
        Worksheets("Temp1").Range("F54").value = VariableDbl2
    I am trying to create a loop or an array which instead of copying and paste the bottom line and code and making Variable1 to Variable 2 and VariableDbl1 to VariableDbl2. The thing which I was having a problem was is how to increment a String or make a variable with an incremented value after it. Any thoughts?

    I had to do Dim Variable1 as String, then convert it to double afterwards, because or else it would give me a Compile error: ByRef argument type mismatch.
    Instead of making a 5 of these:

    Thanks in advanced
    Last edited by game; 06-19-2007 at 03:00 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1