Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
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
delete range using VBA Wanna Learn Excel Discussion (Misc queries) 2 May 7th 23 11:45 AM
How to Delete blanks between a range and populate only the names inthe given range Yuvraj Excel Discussion (Misc queries) 2 November 4th 09 08:32 PM
delete a range The Weather Girl Excel Worksheet Functions 4 July 13th 09 03:51 PM
How to Delete a Range in Closed Workbook (to Replace Delete Query) [email protected] Excel Discussion (Misc queries) 1 March 8th 06 10:10 AM
DELETE RANGE NAME gus Excel Programming 3 September 23rd 03 07:25 AM


All times are GMT +1. The time now is 11:26 AM.

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

About Us

"It's about Microsoft Excel"