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?

Hello,

I'm struggling with creating this Macro. We did some of this stuff at School but it seems to have forgotten me :(

I have been typing up my price lists and would like a button to the side where the member of staff would have one box where they could type in what they know about the product i.e. Code and/or partial description. Ideally the item would be found and perhaps lightly highlighted.

Any chances anyone has one of these Macros around??

Cheers for any help,
Robert:beer:
Help me to help you :santa2:
«13

Comments

  • PaulK_3
    PaulK_3 Posts: 1,146 Forumite
    Something like:
    this?
  • one hiccup is that it won't find anything that is linked to another page.

    Example
    Tab 1 - holds formulaes linking it to tab 3
    Tab 3 - 11331

    If I search for 11331 on Tab 1 it won't find it as it isn't on there only a formula (=Tab3 Cell 2)
    Help me to help you :santa2:
  • I need the spreadsheet to search for what the formula values equal not what literally they are ie the formula
    Help me to help you :santa2:
  • FTD
    FTD Posts: 137 Forumite
    one hiccup is that it won't find anything that is linked to another page.

    Example
    Tab 1 - holds formulaes linking it to tab 3
    Tab 3 - 11331

    If I search for 11331 on Tab 1 it won't find it as it isn't on there only a formula (=Tab3 Cell 2)

    Stick this line in the code before the cell.search
    Sheets("Tab3").Activate
    and activate the cell you want to begin searching from

    Cells(1, 1).Activate

    At the end of the macro you can return to tab1 the same way. (obviously replace Tab3 with the name of your worksheet.)

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

    cell.Search
    Sheets("Prices").Activate
    Cells(1, 1).Activate

    Cells.Find(What:=strFindWhat, After:=ActiveCell, LookIn:=xlFormulas, LookAt _
    :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
    False).Select
    Exit Sub
    ErrorMessage:
    MsgBox ("The information you have searched does not exist")
    End Sub
    Help me to help you :santa2:
  • Doesn't seem to know the information is displayed on Trade but I want it to show the info on Prices
    Help me to help you :santa2:
  • f1charlie
    f1charlie Posts: 1,228 Forumite
    Perhaps you need "LookIn:=xlValues" rather than xlFormulas?
    Charlie
  • This is a copy of what I have ended up with now... but again it doesn't see what I see?? I appreciate your help everyone!!

    Any other ideaS?? Cheers!!!

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

    cell.Search
    Sheets("Trade").Activate
    Cells(1, 1).Activate

    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
    Help me to help you :santa2:
  • f1charlie
    f1charlie Posts: 1,228 Forumite
    If you want to search on the prices sheet you need a "Sheets("Prices").Activate"
    Charlie
  • Hmm... still no luck!
    Sure we are getting closer-
    Company.jpg
    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.