Results 1 to 6 of 6

Using the Find Function inside the Right function in macro

Threaded View

  1. #1
    Registered User
    Join Date
    05-22-2013
    Location
    Tupelo, MS
    MS-Off Ver
    Excel 2013
    Posts
    3

    Using the Find Function inside the Right function in macro

    I have a column with data that I am wanting to clean up and place into a new column.

    I begin by finding the last row with data and setting that to LR
    Then I create a new column and add a value for a header

    I want to to use the right function in conjunction with the Find function to look for a specific string and return everything to the right of that string as a value I am placing in a newly created column.

    I am getting a Type mismatch error 13.

    I have narrowed down, by removing pieces of code, that the issue is with the Find portion of the code in this line.

    Below is my stab at performing this task. Any help would be much appreciated. I am new to vba and learning as I go.

    Sub cleanUpFileName()

    Dim LR As Long, i As Long

    LR = Range("C" & Rows.Count).End(xlUp).Row
    Worksheets(1).Columns(4).Insert shift:=xlRight
    Worksheets(1).Range("D1").Value = "test_file"

    For i = 2 To LR
    With Range("C" & i)
    Select Case .Value
    Case "": .Offset(, 1).Value = "Null"
    'Case Else: .Offset(, 1).Value = Right(.Value, Len(.Value) - .Find("testfiles/", (.Value)) - 9)
    Case Else: .Offset(, 1).Value = Right(.Value, Len(.Value) - .Find(What:="testfiles/", LookIn:=(.Value), MatchCase:=False))
    End Select
    End With
    Next i

    End Sub



    Thanks in advance!
    Last edited by namruht; 08-27-2013 at 12:55 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 0
    Last Post: 01-19-2013, 01:35 PM
  2. [SOLVED] Using ROW function inside of both an Indirect and Index function returns #VALUE
    By xandermacleod in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 09-11-2012, 06:22 PM
  3. Function inside Macro that move a range rows if cells are used
    By oguilamo in forum Excel - New Users/Basics
    Replies: 0
    Last Post: 08-29-2012, 11:51 PM
  4. Macro does not function inside a list control
    By Stephen Giles in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-08-2006, 03:40 PM
  5. HELP NEEDED FOR IF Function Inside a Macro
    By Sandi in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-01-2006, 11:20 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