Results 1 to 3 of 3

"Run-time error '13': Type mismatch" when deleteing multiple cells from targeted columns

Threaded View

  1. #1
    Registered User
    Join Date
    09-26-2012
    Location
    Buffalo
    MS-Off Ver
    Excel 2010
    Posts
    2

    "Run-time error '13': Type mismatch" when deleteing multiple cells from targeted columns

    I'm new to this forum but it looks like the place to be to get help with Macros

    I have the following code that works great, it essentially puts Auto Caps on anything in columns B, F, AA, and DX which is what I want but when I go to delete multiple items in the same row from these columns I get this error: "Run-time error '13': Type mismatch"

    I then select debug and it highlights this line in yellow from my code: Target = UCase(Target)

    Here's my code:
    Private Sub Worksheet_Change(ByVal Target As Range)
      Dim LastRow As Long
      Dim Rng As Range
      Dim StartCell As String
      Dim StartRow As Long
      
        StartCell = "B2"
        
          With Range(StartCell)
            C = .Column
            StartRow = .Row
          End With
          
          LastRow = Cells(Rows.Count, C).End(xlUp).Row
          LastRow = IIf(LastRow < StartRow, StartRow, LastRow)
          Set Rng = Range(Cells(StartRow, C), Cells(LastRow, C))
          
       Application.EnableEvents = False
       
            Select Case Target.Column
              Case 2, 6, 27, 128
                Target = UCase(Target)
              End Select
          
        Application.EnableEvents = True
    End Sub
    Any help would be greatly appreciated!

    Thanks!
    Last edited by JosephP; 09-26-2012 at 12:48 PM. Reason: add code tags

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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