LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default sub for deleting data on a sheet in a range

I need a sub procedure that deletes data on a definited sheet in a definited
unnamed range(and only if background of the cell is yellow). I tried to
write it but it doesn't work. When I call the sub procedure, visual basic
says "syntax error" :( does anyone know why?

Private Sub delete_data(sheet as string, ra, rb, column as integer)
With Worksheets(sheet)
For index = ra To rb
If .Cells(index, column).Interior.ColorIndex = 6 Then
.Cells(index, column) = ""
End If
Next index
End With
End Sub

Private Sub cmdButton_Click()
delete_data("shtHM",7,23,3)
End Sub


 
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
How do I copy a range of data to another sheet? MrNobody Excel Worksheet Functions 2 February 19th 09 03:38 AM
Extracting/deleting select data from range of cell DipyDawg Excel Discussion (Misc queries) 4 May 6th 08 06:48 PM
how to transfer data from sheet to sheet with new range? Jon Excel Discussion (Misc queries) 6 August 20th 07 06:36 PM
Deleting cell data without deleting formula Tom Hall Excel Discussion (Misc queries) 4 October 29th 06 04:07 PM
Deleting Range name's listed in the range address box. Satnam Patel Excel Discussion (Misc queries) 4 May 5th 05 01:42 PM


All times are GMT +1. The time now is 10:30 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"