Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 61
Default ActiveCell offset delete

I would like a code if anyone could help please to delete the contents of a
cell based on the data in another cell.
I would like it so that if the activecell offset by 4 = Mech, then
activecell offset by 10 is deleted.
I need it using activecell as it is all tied into a userform that opens on
various cells in column C, therefore I cannot reference a particular cell.
Any ideas
Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default ActiveCell offset delete

If ActiveCell.Offset(0, 4).Value = "Mech" Then
ActiveCell.Offset(0, 10).ClearContents
End If

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default ActiveCell offset delete

Offset to the right
or
Offset down?
--
Gary''s Student


"Woodi2" wrote:

I would like a code if anyone could help please to delete the contents of a
cell based on the data in another cell.
I would like it so that if the activecell offset by 4 = Mech, then
activecell offset by 10 is deleted.
I need it using activecell as it is all tied into a userform that opens on
various cells in column C, therefore I cannot reference a particular cell.
Any ideas
Thanks

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default ActiveCell offset delete

Assuming horizontal offset:

Sub clearit()
With ActiveCell
If .Offset(0, 4).Value = "Mech" Then
.Offset(0, 10).Clear
End If
End With
End Sub

--
Gary''s Student - gsnu200839


"Woodi2" wrote:

I would like a code if anyone could help please to delete the contents of a
cell based on the data in another cell.
I would like it so that if the activecell offset by 4 = Mech, then
activecell offset by 10 is deleted.
I need it using activecell as it is all tied into a userform that opens on
various cells in column C, therefore I cannot reference a particular cell.
Any ideas
Thanks

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 61
Default ActiveCell offset delete

Thanks, that works great.
In answer to the first question, yes, its offset to the right.
How could I include to lock the cell in this code.
I already protect the sheet under another code so dont need to worry about
that.

"Test" wrote:

If ActiveCell.Offset(0, 4).Value = "Mech" Then
ActiveCell.Offset(0, 10).ClearContents
End If




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default ActiveCell offset delete

To lock the cleared cell:

Sub clearit()
With ActiveCell
If .Offset(0, 4).Value = "Mech" Then
.Offset(0, 10).Clear
.Offset(0, 10).Locked = True
End If
End With
End Sub


--
Gary''s Student - gsnu200839


"Woodi2" wrote:

Thanks, that works great.
In answer to the first question, yes, its offset to the right.
How could I include to lock the cell in this code.
I already protect the sheet under another code so dont need to worry about
that.

"Test" wrote:

If ActiveCell.Offset(0, 4).Value = "Mech" Then
ActiveCell.Offset(0, 10).ClearContents
End If


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
If activecell.column = variable then activecell,offset (0,1) Battykoda via OfficeKB.com Excel Discussion (Misc queries) 1 October 2nd 07 08:05 PM
ActiveCell Offset rnrss[_2_] Excel Programming 0 October 7th 05 10:12 AM
Activecell Offset Mark Excel Programming 2 December 7th 04 04:57 PM
ActiveCell.Offset w/ VBA Bob Umlas[_3_] Excel Programming 2 September 4th 04 02:58 PM
activecell offset rvik Excel Programming 1 December 24th 03 07:47 AM


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