+ Reply to Thread
Results 1 to 2 of 2

Column Cell Count with variable in column marker, Type mismatch

Hybrid View

  1. #1
    Registered User
    Join Date
    01-31-2013
    Location
    Wisconsin USA
    MS-Off Ver
    Excel 2010
    Posts
    56

    Column Cell Count with variable in column marker, Type mismatch

    Having some problems on this one, im sure its right in front of me. Can anyone help find out why this is?

    Type Mismatch

    Dim ColumnsInsert As Integer
    Dim MyCountVar As Integer
    Dim ColLetter As String
    ----------------------------------------------------------------
    Sub Test ()
    
    CheckColLetter
    
    GetCellCountsColVar
    
    ActiveSheet.Range("" & ColLetter & "1:" & ColLetter & "" & MyCountVar & "").RemoveDuplicates Columns:=1, Header:=xlNo
    
    End Sub
    ----------------------------------------------------------------
    Sub GetCellCountsColVar ()
    
    'Errors>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    MyCountVar = Cells(ActiveSheet.Rows.Count, " & ColumnsInsert & ").End(xlUp).Row
    'End Error>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    LastPlusOneVar = MyCountVar + 1
    
    End Sub
    ----------------------------------------------------------------
    Sub CheckColLetter ()
    
    Select Case ColumnsInsert
        Case "2"
          ColLetter = "B"
        Case "3"
          ColLetter = "C"
        Case "4"
          ColLetter = "D"
        Case "5"
          ColLetter = "E"
        Case "6"
          ColLetter = "F"
        Case "7"
          ColLetter = "G"
        Case "8"
          ColLetter = "H"
    End Select
    
    End Sub

  2. #2
    Registered User
    Join Date
    01-31-2013
    Location
    Wisconsin USA
    MS-Off Ver
    Excel 2010
    Posts
    56

    Re: Column Cell Count with variable in column marker, Type mismatch

    wow.... the " & & " around the variable dont need to be there. not sure why though. can anyone elaborate on this?

+ Reply to Thread

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