+ Reply to Thread
Results 1 to 7 of 7

Extract text from cells?

Hybrid View

  1. #1
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,524
    Open a new workbook

    Place your formula
    =(53+42+55+52+52+54+57+57+56+55+57+51+53+57+46+54+28 )/(SUM(Daily!$F$97:$F$113))
    in A1 and then run this code

    Sub Macro5()
    '
    ' Macro5 Macro
    ' Macro recorded 3/11/2007 by Dave Morrison
    Application.DisplayAlerts = False
    Sheets("Sheet1").Range("A1").Copy Destination:=Sheets("Sheet2").Range("A1")
        Sheets("Sheet2").Select
        Range("A1").Select
    
        ActiveCell.Replace What:="=(", Replacement:="", LookAt:=xlPart, _
            SearchOrder:=xlByRows, MatchCase:=True
    ActiveCell = Left(ActiveCell, Len(ActiveCell) - 28)
        Selection.TextToColumns Destination:=ActiveCell, DataType:=xlDelimited, _
            TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
            Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar _
            :="+", FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, _
            1), Array(6, 1), Array(7, 1), Array(8, 1), Array(9, 1), Array(10, 1), Array(11, 1), Array(12 _
            , 1), Array(13, 1), Array(14, 1), Array(15, 1), Array(16, 1), Array(17, 1))
    Application.DisplayAlerts = True
    
    End Sub

    I am not sure about deleteing

    )/(SUM(Daily!$F$97:$F$113))
    this example will work, but if you have different sized formulas it might not


    Maybe somebody can add to this

    ActiveCell = Left(ActiveCell, Len(ActiveCell) - 28)
    so it will subtract the actual number of text from ")" to")"

  2. #2
    Registered User
    Join Date
    03-10-2007
    Location
    USA
    Posts
    21

    Thumbs up

    Dude! It works!!

    Thanks!
    A novice but somewhat experianced Excel user,
    Dave

  3. #3
    Valued Forum Contributor Richard Schollar's Avatar
    Join Date
    05-23-2006
    Location
    Hampshire UK
    MS-Off Ver
    Excel 2002
    Posts
    1,264
    As a quick and dirty approach, it might have been a lot simpler to simply convert the formulas to text (eg do a Find/Replace on them, Finding What: = and Replacing With: #=). Then you can copy all the formula text en masse and extract how you like.

    Richard

  4. #4
    Registered User
    Join Date
    03-10-2007
    Location
    USA
    Posts
    21

    Thumbs up

    It worked grrrreat! and saved me bunches of time!
    Thanks!

+ 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