Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Clearing Row Contents (using Intersect?)


I'm back again!

I would be grateful if I could have some help with the following
problem:

I have a spreadsheet that is 306 lines long by 13 coulmns wide. All
cells are 'unprotected' with the exception of columns 'D', 'K' and 'M'
which get their data via fomula from unlocked cells or each other.

What I would like to do is to have a 'button' which will, when pressed,
clear the row of the active cell 'A' i.e' activate a cell in column 'A'
and pressing the 'Clear' button clears the entire adjacent row. (the
ranges would be(""A:C", "E:J", "L")).

I've played around with intersect but can only get the active cell to
clear!

Incidentally, I've a 'Sort' macro which will subsequently move all
empty rows to the bottom of the sheet.

Thanks in advance,

Dave


--
deelee
------------------------------------------------------------------------
deelee's Profile: http://www.excelforum.com/member.php...o&userid=34866
View this thread: http://www.excelforum.com/showthread...hreadid=555327

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Clearing Row Contents (using Intersect?)


Hello Dave,

Here's the macro. Copy and paste this into a VBA module. You can then
call it from your buttons Click() event.

Public Sub Clear()
Dim Rng As Range
With ActiveSheet
Set Rng = Application.Intersect(.Range("A:C"), .Range("E:J"),
..Range("L"))
End With
Rng.ClearContents
End Sub

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=555327

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Clearing Row Contents (using Intersect?)


:( Hi Ross,

Thanks for your quick reply, however, when I use it the routine fails
at the Set Rng statement? I've double checked the ranges and they are
correct.

Thanks again,

Dave


--
deelee
------------------------------------------------------------------------
deelee's Profile: http://www.excelforum.com/member.php...o&userid=34866
View this thread: http://www.excelforum.com/showthread...hreadid=555327

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Clearing Row Contents (using Intersect?)


Sorry Leith, I used your surname in reply!

Dave


--
deelee
------------------------------------------------------------------------
deelee's Profile: http://www.excelforum.com/member.php...o&userid=34866
View this thread: http://www.excelforum.com/showthread...hreadid=555327

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Clearing Row Contents (using Intersect?)

Hi Deelee,

Try:

'=============
Public Sub Tester()
Dim rng As Range

Set rng = Intersect(Range("A:C,E:J,L:L"), _
ActiveCell.EntireRow)
rng.ClearContents

End Sub
'<<=============


---
Regards,
Norman



"deelee" wrote in
message ...

I'm back again!

I would be grateful if I could have some help with the following
problem:

I have a spreadsheet that is 306 lines long by 13 coulmns wide. All
cells are 'unprotected' with the exception of columns 'D', 'K' and 'M'
which get their data via fomula from unlocked cells or each other.

What I would like to do is to have a 'button' which will, when pressed,
clear the row of the active cell 'A' i.e' activate a cell in column 'A'
and pressing the 'Clear' button clears the entire adjacent row. (the
ranges would be(""A:C", "E:J", "L")).

I've played around with intersect but can only get the active cell to
clear!

Incidentally, I've a 'Sort' macro which will subsequently move all
empty rows to the bottom of the sheet.

Thanks in advance,

Dave


--
deelee
------------------------------------------------------------------------
deelee's Profile:
http://www.excelforum.com/member.php...o&userid=34866
View this thread: http://www.excelforum.com/showthread...hreadid=555327





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Clearing Row Contents (using Intersect?)


;) Hi Norman and thank you!

It worked a treat - another one for my library!

Dave


--
deelee
------------------------------------------------------------------------
deelee's Profile: http://www.excelforum.com/member.php...o&userid=34866
View this thread: http://www.excelforum.com/showthread...hreadid=555327

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
Clearing Contents AMANDA Excel Discussion (Misc queries) 2 July 6th 09 05:34 PM
clearing the contents of specified cells Jimmy Pop Excel Programming 5 May 27th 05 01:17 AM
Clearing Contents Sean Excel Programming 5 May 6th 05 05:16 PM
Clearing Contents of Cell Burt Excel Worksheet Functions 1 May 4th 05 02:46 PM
Clearing Contents but not Formulas Louise Excel Worksheet Functions 6 January 27th 05 05:04 PM


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