Hi all
I wish to learn more about VBA programming, if it is a simple answer.
I have one question, What vba code would you use to to search for the contents of a cell.
Thank you
Peter
Hi all
I wish to learn more about VBA programming, if it is a simple answer.
I have one question, What vba code would you use to to search for the contents of a cell.
Thank you
Peter
One I have learnt over the last few months, " You are NEVER too old to learn ".
Sometimes I forget to say " Thank You " for your assistance, so here I say " A BIG Thank You. "
There's more than one way to find stuff using VBA. Two methods come immediately to mind:
1) Using the Range.Find method: https://docs.microsoft.com/en-us/off...cel.Range.Find which is equivalent to using the "Find" command from the home tab.
2) Calling Excel's lookup functions from VBA: https://docs.microsoft.com/en-us/pre...1(v=office.14).
Which method to use depends on what you want to do once you find the information you are looking for.
Originally Posted by shg
mrshorty AKA ??
Me Peter
along the lines of If cell "X" = " " then Stop " Y " from displaying anything.
Good afternoon k1dr0ck
I will try adding on top of of some existing code.
Thanks
Peter
Greetings and sundry
Owing to the Enduro Exec's moving the goal post, I have to rethink all of my project.
I will sign off that the outstanding 2 current threads are Solved and re-apply for help later
after I have had time to work out the logics.
Peter![]()
Att Ali
If I may would you mind commenting on what each line does in this coding
so I can look at doing my attack at it please.
Because this is one area I have to manipulate.
![]()
Application.EnableEvents = False ' If Target.Offset(, -4) >= 1 And Target.Offset(, -4) <= 100 Then ' Select Case val ' Case 1 To 3: Target.Offset(, -2) = "1st leg" ' Case 4 To 7: Target.Offset(, -2) = "2nd leg"
You seem to think that I am the fount of all knowledge, which I suppose is flattering. I did not provide the code, so the caveat is that I may have interpreted it incorrectly, however I'll have a go:
Have you started to collate a notebook of code snippets with reminders about what they do? If not, then you are not really getting the best out of the help offered here, and will end up coming back and asking the same questions over and over again, which might aggravate (some of) your helpers.![]()
Application.EnableEvents = False ' If the cell 4 to the left of the selected cell is between 1 and 100 then If Target.Offset(, -4) >= 1 And Target.Offset(, -4) <= 100 Then ' Look at the cell 2 to the left of the selected cell and check its value Select Case val ' If that cell's value is between 1 and 3, return "1st leg" in the selected cell Case 1 To 3: Target.Offset(, -2) = "1st leg" ' If that cell's value is between 4 and 7, return "2nd leg" in the selected cell Case 4 To 7: Target.Offset(, -2) = "2nd leg"
![]()
Last edited by AliGW; 07-25-2019 at 02:20 AM.
Ali
Enthusiastic self-taught user of MS Excel who's always learning!
Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.
NB: as a Moderator, I never accept friendship requests.
Forum Rules (updated August 2023): please read them here.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks