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 and columns

Hello World,

Yes it's me again... Don't mean to post all day, but I ran into a
problem... How can I clear certain rows and colums.? If the active cell
is B6 then B6 and F6 would be cleared. If B7 is the active cell then B7
and F7 would be cleared, and so on... Same with a different selection;
if L6 is the active cell then L6 and Q6 would be cleared and if L7 is
the active cell then L7 and Q7 would be cleared, and so on... Also,
what would be the best way to trigger this; as an opbutton or
cmdbutton. I can't have both sides cleared at the same time i.e., B6,F7
and L6,Q6. They have to be cleared separately, because only one side
might need clearing...

If more info is needed let me know :)

I know this is probably confusing w/o seeing the worksheet (sorry)

Thanks for any help :)

Rockee Freeman


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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 391
Default Clearing row and columns

use an offset eg

if Target is the selected cell

Target.Value =""
Target.Offset(0,col_offset).Value =""

where you set the variable col_offset to whatever number
of columns you need, 4 so b7 or (7,2) offsets to (7,6)
which is F7

I'd use the right mouse button...so on the sheet's code
page ( right click the sheet tab & select View Code) add
this:
Private Sub Worksheet_BeforeRightClick(ByVal Target As
Range, Cancel As Boolean)
Dim myOffset As Long
Select Case Target.Column
Case 2
myOffset = 4
Case 12
myOffset = 5
Case Else
End Select
If myOffset 0 Then
Cancel = True
Target.Value = ""
Target.Offset(0, myOffset).Value = ""
End If
End Sub


Patrick Molloy
Microsoft Excel MVP



-----Original Message-----
Hello World,

Yes it's me again... Don't mean to post all day, but I

ran into a
problem... How can I clear certain rows and colums.? If

the active cell
is B6 then B6 and F6 would be cleared. If B7 is the

active cell then B7
and F7 would be cleared, and so on... Same with a

different selection;
if L6 is the active cell then L6 and Q6 would be cleared

and if L7 is
the active cell then L7 and Q7 would be cleared, and so

on... Also,
what would be the best way to trigger this; as an

opbutton or
cmdbutton. I can't have both sides cleared at the same

time i.e., B6,F7
and L6,Q6. They have to be cleared separately, because

only one side
might need clearing...

If more info is needed let me know :)

I know this is probably confusing w/o seeing the

worksheet (sorry)

Thanks for any help :)

Rockee Freeman


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

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Clearing row and columns

Patrick,

Thanks, that should do the trick

Rockee Freema

--
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
Clearing cells without clearing formulas marsjune68 Excel Discussion (Misc queries) 2 April 10th 09 07:39 PM
Clearing out blank rows/columns SteveDB1 Excel Worksheet Functions 3 October 18th 07 11:25 PM
Clearing #N/A's in one go? Lee Harris Excel Worksheet Functions 5 November 22nd 05 06:52 PM
Clearing #VALUE skateblade Excel Worksheet Functions 3 October 15th 05 10:34 PM
Clearing information in certain columns jolly_lolly Excel Discussion (Misc queries) 1 April 22nd 05 02:41 AM


All times are GMT +1. The time now is 12:51 PM.

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"