View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
gavmer[_45_] gavmer[_45_] is offline
external usenet poster
 
Posts: 1
Default deleting wrong range!

Sorry all, here is the code or i can e-mail a workbook??

Private Sub CommandButton1_Click()
Dim rng As Range, x As Single
Dim wsquote As Worksheet
Set wsquote = Worksheets("sheet2")
Set rng = wsquote.Range("foldunit2")
x = rng.Rows.Count
rng.Range("foldunit2").ClearContents
rng.Offset(0, 0).Resize(x).EntireRow.Delete
'Sheets("sheet 1").Range("range").ClearContents
End Sub

Private Sub CommandButton2_Click()
Dim rng As Range, x As Single
Dim wsquote As Worksheet
Set wsquote = Worksheets("sheet2")
Set rng = wsquote.Range("knifeunit2")
x = rng.Rows.Count
rng.Range("knifeunit2").ClearContents
rng.Offset(0, 0).Resize(x).EntireRow.Delete
'Sheets("sheet 1").Range("range").ClearContents
End Sub
Private Sub CommandButton3_Click()
Dim rng As Range, x As Single
Dim wsquote As Worksheet
Set wsquote = Worksheets("sheet2")
Set rng = wsquote.Range("knifeunit3")
x = rng.Rows.Count
rng.Range("knifeunit3").ClearContents
rng.Offset(0, 0).Resize(x).EntireRow.Delete
'Sheets("sheet 1").Range("range").ClearContents
End Su

--
Message posted from http://www.ExcelForum.com