Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
i am trying to write a macro the clears the cells from a fixed starting
point to a keyword whose location could change everyday. i want to clear a range of cells (say a1:g1) and all the rows from the fixed starting point to the row above the keyword. For some reason i can't figure what to do. Any help would be appreciated. Thanks! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Jimmy,
Here is a simple macro that gives you must of what you want. Sub Findit() Dim cell As Range Dim myKeyword myKeyword = "Bob" Set cell = Cells.Find(myKeyword) If Not cell Is Nothing Then Range("A1:G" & cell.Row - 1).ClearContents End If End Sub -- HTH RP (remove nothere from the email address if mailing direct) "Jimmy Pop" wrote in message oups.com... i am trying to write a macro the clears the cells from a fixed starting point to a keyword whose location could change everyday. i want to clear a range of cells (say a1:g1) and all the rows from the fixed starting point to the row above the keyword. For some reason i can't figure what to do. Any help would be appreciated. Thanks! |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Bob!
This works great, except it is deleting the final row that has my "keyword" as well as other data i need. to fix this what do i need to change? you can tell that i am very new to the macro world. Thanks again!! |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Are you sure Jimmy, I just tried it again and it kept cells A-G on the
keyword row intact Sub Findit() Dim cell As Range Dim myKeyword myKeyword = "Bob" Set cell = Cells.Find(myKeyword) If Not cell Is Nothing Then Range("A1:G" & cell.Row - 1).ClearContents End If End Sub -- HTH RP (remove nothere from the email address if mailing direct) "Jimmy Pop" wrote in message oups.com... Thanks Bob! This works great, except it is deleting the final row that has my "keyword" as well as other data i need. to fix this what do i need to change? you can tell that i am very new to the macro world. Thanks again!! |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
you're right! i had a typo!
thanks so much!!! |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
you're right! i had a typo!
thanks so much!!! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Clearing Contents | Excel Discussion (Misc queries) | |||
Clearing the Contents of Merged Cells | New Users to Excel | |||
Clearing Contents | Excel Programming | |||
Clearing Contents of all "unprotected" Cells. | Excel Programming | |||
Clearing the contents of merged cells | Excel Programming |