We’d like to remind Forumites to please avoid political debate on the Forum.

This is to keep it a safe and useful space for MoneySaving discussions. Threads that are – or become – political in nature may be removed in line with the Forum’s rules. Thank you for your understanding.

📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!

Excel Macro Help?

2

Comments

  • Also it doesn't actually find it if I literally just type in Train. So it really isn't working?
    Help me to help you :santa2:
  • f1charlie
    f1charlie Posts: 1,228 Forumite
    Try this:

    Private Sub FindButton_Click()
    Dim strFindWhat As String
    strFindWhat = TextBox1.Text
    On Error GoTo ErrorMessage

    Sheets("Prices").Activate

    ThisWorkbook.Sheets("Prices").Cells.Find(What:=strFindWhat, After:=ActiveCell, LookIn:=xlValues, LookAt _
    :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
    False).Select

    Exit Sub
    ErrorMessage:
    MsgBox ("The information you have searched does not exist")
    End Sub
    Charlie
  • nope!? Aragh lol

    I'll make another print screen, cheers for this
    Help me to help you :santa2:
  • code.jpg
    Help me to help you :santa2:
  • f1charlie
    f1charlie Posts: 1,228 Forumite
    It works for me! Has a space sneaked into your strFindWhat?
    Charlie
  • removed the space and it said compile error : syntax error
    Help me to help you :santa2:
  • Hold on it turns out there was a space at the end of the look at bit!! It works!!!!!

    THANK YOU SOOOO MUCH
    Help me to help you :santa2:
  • THANK YOU THAT IS GREAT!! LOL I'm way too happy about this
    Help me to help you :santa2:
  • Have you got any other tips or advice to improve the spreadsheets?

    How about when I have nothing in the cells but another cell adds up when there is information. Maybe it will be easier explained in a screen print
    formula.jpg
    Help me to help you :santa2:
  • I have this a lot. Formulas in one cell don't seem to like being lazy! They want information to add up. I remember there is a way to display nothing if there is nothing to add up?
    Help me to help you :santa2:
This discussion has been closed.
Meet your Ambassadors

🚀 Getting Started

Hi new member!

Our Getting Started Guide will help you get the most out of the Forum

Categories

  • All Categories
  • 352.1K Banking & Borrowing
  • 253.6K Reduce Debt & Boost Income
  • 454.2K Spending & Discounts
  • 245.1K Work, Benefits & Business
  • 600.7K Mortgages, Homes & Bills
  • 177.5K Life & Family
  • 258.9K Travel & Transport
  • 1.5M Hobbies & Leisure
  • 16.1K Discuss & Feedback
  • 37.6K Read-Only Boards

Is this how you want to be seen?

We see you are using a default avatar. It takes only a few seconds to pick a picture.