Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete range
Hi all,
Im having a problem with code deleting more than it should. With th code below, i am running it multiple times with different buttons Problem is, it tends to delete other data on occassions that is no part of the range. I dont know why. The data it deletes is data paste from another sheet where the code works ok? Does this mean anything? I it the code??? Any ideas???? Cheers!! -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete range
sorry, here is the code:
Private Sub Commandbutton4_click() Dim rng As Range, x As Single Dim wsquote As Worksheet Set wsquote = Worksheets("sheet2") Set rng = wsquote.Range("no278") x = rng.Rows.Count rng.Range("no278").ClearContents rng.Offset(0, 0).Resize(x).EntireRow.Delete 'Sheets("sheet 1").Range("range").ClearContents End Sub Private Sub CommandButton5_Click() Dim rng As Range, x As Single Dim wsquote As Worksheet Set wsquote = Worksheets("sheet2") Set rng = wsquote.Range("no268") x = rng.Rows.Count rng.Range("no268").ClearContents rng.Offset(0, 0).Resize(x).EntireRow.Delete 'Sheets("sheet 1").Range("range").ClearContents End Sub Private Sub CommandButton6_Click() Dim rng As Range, x As Single Dim wsquote As Worksheet Set wsquote = Worksheets("sheet2") Set rng = wsquote.Range("no3") x = rng.Rows.Count rng.Range("no3").ClearContents rng.Offset(0, 0).Resize(x).EntireRow.Delete 'Sheets("sheet 1").Range("range").ClearContents End Su -- Message posted from http://www.ExcelForum.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
delete range using VBA | Excel Discussion (Misc queries) | |||
How to Delete blanks between a range and populate only the names inthe given range | Excel Discussion (Misc queries) | |||
delete a range | Excel Worksheet Functions | |||
How to Delete a Range in Closed Workbook (to Replace Delete Query) | Excel Discussion (Misc queries) | |||
DELETE RANGE NAME | Excel Programming |