LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default lookup value then clear some cells

Thanks, that works perfectly

"Jim Thomlinson" wrote:

Sub DeleteStock()
Dim wksMain As Worksheet
Dim wksToSearch As Worksheet
Dim rngToFind As Range
Dim rngToSearch As Range
Dim rngFound As Range

Set wksMain = Sheets("Sheet1") 'sheet with the button
Set rngToFind = wksMain.Range("A2") 'Cell to look up
Set wksToSearch = Sheets("Sheet2") 'Sheet to search
Set rngToSearch = wksToSearch.Columns("B") 'Range to search

Set rngFound = rngToSearch.Find(rngToFind.Value)
If rngFound Is Nothing Then
MsgBox "Sorry that part was not found"
Else
rngFound.Offset(0, 3).ClearContents
End If

End Sub

--
HTH...

Jim Thomlinson


"Y Sbuty" wrote:

The stock number is unique and stored in column B, when the stock numer is
found, i need to clear the 3 cells to the right of the stock number (same
row), but leaving the stock number

"Jim Thomlinson" wrote:

Does/could the stock number exist more than once on the second sheet meaning
that more than one cell is potentially going to need to be cleared?
--
HTH...

Jim Thomlinson


"Y Sbuty" wrote:

Hello,

I am trying to set up a stock control spreadsheet...

What i'd like to be able to do is enter a stock number in a cell on sheet1,
press a 'delete' button, it would then lookup the stock number in a list on
sheet2, and then delete 3 cells to the right of the stock number.

It sounds easy enough, but i'm struggling a bit!

Any help would be greatly appreciated, Thanks,

YS



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cells.Clear Ben Dummar Excel Discussion (Misc queries) 3 January 24th 07 10:50 PM
clear contents cells of unprotected cells Ed Excel Programming 6 January 12th 06 06:09 PM
Clear Cells Mike Excel Discussion (Misc queries) 4 November 20th 05 11:50 PM
Clear cells with #N/A mthomas[_6_] Excel Programming 4 August 12th 05 04:24 PM
Clear cells range if certain cells are all empty gschimek - ExcelForums.com Excel Programming 6 May 13th 05 10:38 PM


All times are GMT +1. The time now is 10:22 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"