Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50067

How to delete a cell with part of string on other sheet ??

$
0
0
Hi All,

I have a nice sheet with a lot of different codes and functions but I'm looking for a search and delete function.
I've tried many options that I could find using the search functions but it's not working.
What I need is a code that will search for a string the user put in Textbox1 on a userform, and delete the cell that contains this string on a different worksheet and moves the rest of the row up so the empty cell is also gone
For example: cell D6 of sheet3 contains the text: TC000-123-234-345
a user puts in the text 123-234 on a userform in Textbox1
The search function should find this text in cell D6 on Sheet3 and then delete this cell
After that all other cells in row D should move up one place so D7 becomes D6, D8 becomes D7 etc.
I already found something like this:
Code:

Set FoundRange = Sheet3.Cells.Find(TextBox1)
MsgBox FoundRange.Address

This code correctly shows me $d$6 in a message box but I can't find the way to delete the cell instead of showing it

Viewing all articles
Browse latest Browse all 50067

Trending Articles