Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default Deleteing cells

Can someone help. this is what I have so far...

Sub deleting_cells()

Columns("A:A").Select
Selection.Find(What:="Quantity", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.Offset(4, 0).Select
ActiveCell.Offset.End(xlToRight).Select
ActiveCell.Offset(0, -6).Range("A1").Select

' From this point I want to delete every cell to the left of this active
cell minus 1 (essentially the cell in column A) I have read through dozens of
posts, but can't seam to figure it out.
After deleteing these cells, I want to drop down to the next row, move to
the last to the right and continue deleting info as needed via a loop.

this is probably very easy, but I am new to the whole vba world.

Thanks
Peter


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Deleteing cells

I'm lost. In simple language can you explain what it is you want. I am
guessing here but are you looking to find all instances of "quantity" in
Column A and then delete some of the info from those lines??? Guessing again
but did you want to delete all of the cells except the right most cell??? Did
you want to leave the word quantity or did you want to get rid of that also???
--
HTH...

Jim Thomlinson


"Looping through" wrote:

Can someone help. this is what I have so far...

Sub deleting_cells()

Columns("A:A").Select
Selection.Find(What:="Quantity", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.Offset(4, 0).Select
ActiveCell.Offset.End(xlToRight).Select
ActiveCell.Offset(0, -6).Range("A1").Select

' From this point I want to delete every cell to the left of this active
cell minus 1 (essentially the cell in column A) I have read through dozens of
posts, but can't seam to figure it out.
After deleteing these cells, I want to drop down to the next row, move to
the last to the right and continue deleting info as needed via a loop.

this is probably very easy, but I am new to the whole vba world.

Thanks
Peter


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default Deleteing cells

Sorry for the confusion Jim,

Finding Quantity is just my starting point. There is information above that
point I want to keep. I offset 4 cells down and all the way to the right,
Because the information I want to keep is always located in cell "A?" and in
the last 6 cells of any row under Quantity. The info I want to delect can be
a range of 3 to 23 cells long. Hence the reason I find the end of the data
row and offset back 6 cells to select my true starting point to loop through
and delete unwanted cells.

Does that help?

"Jim Thomlinson" wrote:

I'm lost. In simple language can you explain what it is you want. I am
guessing here but are you looking to find all instances of "quantity" in
Column A and then delete some of the info from those lines??? Guessing again
but did you want to delete all of the cells except the right most cell??? Did
you want to leave the word quantity or did you want to get rid of that also???
--
HTH...

Jim Thomlinson


"Looping through" wrote:

Can someone help. this is what I have so far...

Sub deleting_cells()

Columns("A:A").Select
Selection.Find(What:="Quantity", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.Offset(4, 0).Select
ActiveCell.Offset.End(xlToRight).Select
ActiveCell.Offset(0, -6).Range("A1").Select

' From this point I want to delete every cell to the left of this active
cell minus 1 (essentially the cell in column A) I have read through dozens of
posts, but can't seam to figure it out.
After deleteing these cells, I want to drop down to the next row, move to
the last to the right and continue deleting info as needed via a loop.

this is probably very easy, but I am new to the whole vba world.

Thanks
Peter


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Deleteing cells

So if I find Quantity in Cell A10 then I go down 4 rows to A14. The last
populated cell in row 14 is in column K for example so K14. You want to
delete cells A14 through E14. Once that is done then go down to the next row
and evealute that row (15). If the last populted cell in row 15 is J15 then
delete A15:D15. How long does this process continue. Assuming I have it
right...
--
HTH...

Jim Thomlinson


"Looping through" wrote:

Sorry for the confusion Jim,

Finding Quantity is just my starting point. There is information above that
point I want to keep. I offset 4 cells down and all the way to the right,
Because the information I want to keep is always located in cell "A?" and in
the last 6 cells of any row under Quantity. The info I want to delect can be
a range of 3 to 23 cells long. Hence the reason I find the end of the data
row and offset back 6 cells to select my true starting point to loop through
and delete unwanted cells.

Does that help?

"Jim Thomlinson" wrote:

I'm lost. In simple language can you explain what it is you want. I am
guessing here but are you looking to find all instances of "quantity" in
Column A and then delete some of the info from those lines??? Guessing again
but did you want to delete all of the cells except the right most cell??? Did
you want to leave the word quantity or did you want to get rid of that also???
--
HTH...

Jim Thomlinson


"Looping through" wrote:

Can someone help. this is what I have so far...

Sub deleting_cells()

Columns("A:A").Select
Selection.Find(What:="Quantity", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.Offset(4, 0).Select
ActiveCell.Offset.End(xlToRight).Select
ActiveCell.Offset(0, -6).Range("A1").Select

' From this point I want to delete every cell to the left of this active
cell minus 1 (essentially the cell in column A) I have read through dozens of
posts, but can't seam to figure it out.
After deleteing these cells, I want to drop down to the next row, move to
the last to the right and continue deleting info as needed via a loop.

this is probably very easy, but I am new to the whole vba world.

Thanks
Peter


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default Deleteing cells

This is correct. except please keep the data in cell A. this should continue
until no data is found in a row.

Thanks
Peter

"Jim Thomlinson" wrote:

So if I find Quantity in Cell A10 then I go down 4 rows to A14. The last
populated cell in row 14 is in column K for example so K14. You want to
delete cells A14 through E14. Once that is done then go down to the next row
and evealute that row (15). If the last populted cell in row 15 is J15 then
delete A15:D15. How long does this process continue. Assuming I have it
right...
--
HTH...

Jim Thomlinson


"Looping through" wrote:

Sorry for the confusion Jim,

Finding Quantity is just my starting point. There is information above that
point I want to keep. I offset 4 cells down and all the way to the right,
Because the information I want to keep is always located in cell "A?" and in
the last 6 cells of any row under Quantity. The info I want to delect can be
a range of 3 to 23 cells long. Hence the reason I find the end of the data
row and offset back 6 cells to select my true starting point to loop through
and delete unwanted cells.

Does that help?

"Jim Thomlinson" wrote:

I'm lost. In simple language can you explain what it is you want. I am
guessing here but are you looking to find all instances of "quantity" in
Column A and then delete some of the info from those lines??? Guessing again
but did you want to delete all of the cells except the right most cell??? Did
you want to leave the word quantity or did you want to get rid of that also???
--
HTH...

Jim Thomlinson


"Looping through" wrote:

Can someone help. this is what I have so far...

Sub deleting_cells()

Columns("A:A").Select
Selection.Find(What:="Quantity", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.Offset(4, 0).Select
ActiveCell.Offset.End(xlToRight).Select
ActiveCell.Offset(0, -6).Range("A1").Select

' From this point I want to delete every cell to the left of this active
cell minus 1 (essentially the cell in column A) I have read through dozens of
posts, but can't seam to figure it out.
After deleteing these cells, I want to drop down to the next row, move to
the last to the right and continue deleting info as needed via a loop.

this is probably very easy, but I am new to the whole vba world.

Thanks
Peter




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Deleteing cells

Give this a whirl...

Sub DeleteStuff()
Dim rngFound As Range
Dim rngToSearch As Range
Dim rng As Range
Dim rngToDelete As Range

Set rngFound = Columns("A").Find(What:="Quantity", _
LookAt:=xlPart, _
LookIn:=xlFormulas, _
MatchCase:=False)
If rngFound Is Nothing Then
MsgBox "Quantity was not found"
Else
Set rngToSearch = Range(rngFound.Offset(4, 0), _
rngFound.Offset(4, 0).End(xlDown))
For Each rng In rngToSearch
Set rngToDelete = Cells(rng.Row, Columns.Count).End(xlToLeft)
If rngToDelete.Column 7 Then
Range(rng.Offset(0, 1), rngToDelete.Offset(0,
-6)).ClearContents
End If
Next rng
End If

End Sub

--
HTH...

Jim Thomlinson


"Looping through" wrote:

This is correct. except please keep the data in cell A. this should continue
until no data is found in a row.

Thanks
Peter

"Jim Thomlinson" wrote:

So if I find Quantity in Cell A10 then I go down 4 rows to A14. The last
populated cell in row 14 is in column K for example so K14. You want to
delete cells A14 through E14. Once that is done then go down to the next row
and evealute that row (15). If the last populted cell in row 15 is J15 then
delete A15:D15. How long does this process continue. Assuming I have it
right...
--
HTH...

Jim Thomlinson


"Looping through" wrote:

Sorry for the confusion Jim,

Finding Quantity is just my starting point. There is information above that
point I want to keep. I offset 4 cells down and all the way to the right,
Because the information I want to keep is always located in cell "A?" and in
the last 6 cells of any row under Quantity. The info I want to delect can be
a range of 3 to 23 cells long. Hence the reason I find the end of the data
row and offset back 6 cells to select my true starting point to loop through
and delete unwanted cells.

Does that help?

"Jim Thomlinson" wrote:

I'm lost. In simple language can you explain what it is you want. I am
guessing here but are you looking to find all instances of "quantity" in
Column A and then delete some of the info from those lines??? Guessing again
but did you want to delete all of the cells except the right most cell??? Did
you want to leave the word quantity or did you want to get rid of that also???
--
HTH...

Jim Thomlinson


"Looping through" wrote:

Can someone help. this is what I have so far...

Sub deleting_cells()

Columns("A:A").Select
Selection.Find(What:="Quantity", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.Offset(4, 0).Select
ActiveCell.Offset.End(xlToRight).Select
ActiveCell.Offset(0, -6).Range("A1").Select

' From this point I want to delete every cell to the left of this active
cell minus 1 (essentially the cell in column A) I have read through dozens of
posts, but can't seam to figure it out.
After deleteing these cells, I want to drop down to the next row, move to
the last to the right and continue deleting info as needed via a loop.

this is probably very easy, but I am new to the whole vba world.

Thanks
Peter


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
Need help with deleteing sheets using VBA Dan Thompson Excel Programming 4 November 8th 06 11:00 PM
Deleteing koba Excel Discussion (Misc queries) 2 November 25th 05 04:11 AM
Deleteing cells in Excel gobonniego Excel Discussion (Misc queries) 7 July 26th 05 05:21 PM
Deleteing some Rows Deepwater Excel Discussion (Misc queries) 1 April 1st 05 06:23 PM
Deleteing Rows Michael Vaughan Excel Programming 2 September 20th 04 09:53 PM


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