Results 1 to 12 of 12

Range Select from another worksheet

Threaded View

  1. #1
    Registered User
    Join Date
    11-12-2012
    Location
    Michigan
    MS-Off Ver
    Excel 2010
    Posts
    48

    Range Select from another worksheet

    Private Sub ComboBox1_Change()
     
    Dim uCode As Integer
    uCode = 1234
     
    Dim Vals As String
      Vals = AccessCredentials.ComboBox1.Value
     
     
    With Sheets("Sheet1").Range("A:A")
        Set c = .Find(Vals, LookIn:=xlValues)
          c.Select
        If Not c Is Nothing Then
            firstAddress = c.Address
            Do
                'MsgBox (c)
                Set c = .FindNext(c)
            Loop While Not c Is Nothing And c.Address <> firstAddress
        End If
    End With
     
     
     
     
    If ComboBox1 = "Applications" Then
    Me.TextBox1.Value = ""
    Me.TextBox2.Value = ""
    Me.TextBox3.Value = ""
    Me.TextBox4.Value = ""
    Else
    Me.TextBox1.Value = ActiveCell.Offset(, 4).Value & vbCrLf & ActiveCell.Offset(, 5).Value & vbCrLf & ActiveCell.Offset(, 6).Value & vbCrLf & ActiveCell.Offset(, 7).Value
    Me.TextBox2.Value = ActiveCell.Offset(, 1).Value
    Me.TextBox4.Value = ActiveCell.Offset(, 3).Value
    If Me.TextBox5.Value = uCode Then
    Me.TextBox3.Value = ActiveCell.Offset(, 2).Value
    End If
    End If
     
    End Sub
    This only works when Sheet1 is selected. If Sheet2 is selected, it returns an error of

    1004
    Select method of Range class failed.

    Sheet1 and Sheet2 are the only sheets in my entire book... When I debug, it goes to the c.Select line...

    I've tried referencing the Sheet1 exactly with Sheets("Sheet1").Range("A:A") and every other possible combination I can think of...
    I do NOT want Sheet1 to need to be selected or even visible necessarily.
    Also the Vals variable is set earlier in the code and returns the correct information...
    Last edited by rybussell; 02-12-2014 at 04:47 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Select range and then transpose to a new worksheet
    By T15K in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-29-2012, 06:27 AM
  2. How do I select a range on a different worksheet?
    By mhart210 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-13-2011, 03:58 PM
  3. select range in another worksheet
    By nazimscr in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-23-2009, 06:43 AM
  4. IF statement to activate worksheet & select Range
    By MentalDrow in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-19-2006, 03:25 PM
  5. [SOLVED] use an input box to select a range and copy to another worksheet
    By Paul in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-03-2006, 11:50 AM

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