Results 1 to 7 of 7

Cant Figure Out How To Use Variables As A Range

Threaded View

Genus Max Cant Figure Out How To Use... 12-21-2019, 08:09 AM
BanginMyHeadOnMyDesk Re: Cant Figure Out How To... 12-21-2019, 08:33 AM
Genus Max Re: Cant Figure Out How To... 12-21-2019, 08:35 AM
Genus Max Re: Cant Figure Out How To... 12-21-2019, 08:36 AM
BanginMyHeadOnMyDesk Re: Cant Figure Out How To... 12-21-2019, 08:41 AM
Genus Max Re: Cant Figure Out How To... 12-21-2019, 08:44 AM
BanginMyHeadOnMyDesk Re: Cant Figure Out How To... 12-21-2019, 08:46 AM
  1. #1
    Forum Contributor
    Join Date
    10-29-2019
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    156

    Cant Figure Out How To Use Variables As A Range

    My script seems to work, when I use Set y = Range("A1:B2"), but when I try to use a variable
    ie Set y = Range("ax:bx") it gives a value of 0.

    Not sure why it isnt working ...

    I've enclosed the sheet, its only a couple of cells, im using for testing.

    Thanks,

    Code is :

    
    Sub GMxs()
    
    Dim xs1 As String
    Dim xs2 As String
    Dim xs3 As String
    Dim xs4 As String
    
    Dim xs5 As String
    Dim xs6 As String
    
    Dim y As Range
    Dim y1 As Range
    
    Dim value As Integer
    
    Dim value1 As Integer
    
    'Cells(1, 2) Cells(1 equals column going down, equals bc etc)
    
     xs5 = Cells(1, 1).Address(RowAbsolute:=False, ColumnAbsolute:=False)
     xs6 = Cells(1, 2).Address(RowAbsolute:=False, ColumnAbsolute:=False)
    
    
    Set y1 = Range("xs5:xs6")
    value1 = Application.Min(y1)
    
    MsgBox " value1 " & value1 & " xs5 " & xs5 & " xs6 " & xs6
    
    End Sub
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Cannot figure out how to create bar chart with line overlay using 3 variables
    By drewforte1087 in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 08-24-2018, 03:13 AM
  2. [SOLVED] Nested Ifs/Ands and some tough to figure out variables - Would appreciate your input
    By westsidebill in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-18-2018, 08:03 AM
  3. [SOLVED] Figure totals of two tables based on multiple variables
    By darbar76528 in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 09-04-2017, 06:13 PM
  4. Replies: 2
    Last Post: 04-27-2015, 12:22 PM
  5. Replies: 4
    Last Post: 02-03-2014, 08:05 AM
  6. Replies: 3
    Last Post: 10-15-2013, 09:59 PM
  7. can't figure out LOOKUP with 2 variables
    By LTUser54 in forum Excel General
    Replies: 1
    Last Post: 05-30-2006, 02:41 PM

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