Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I am trying to figure out how to write a macro that will delete all
information in a row for columns A through O, if the current value of column c in that row = 350. I would post some of the code I have tried but it is a huge mess. I feel like this should be pretty simple. If anyone could help me out it would be much appreciated. I have been trying to use the do while ...=350 but I can't seem to get anything to work. Thanks~ |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() iLastRow = Cells(Rows.Count,"A").End(xlUp).Row For i = iLastRow To 2 Step -1 If Cells(i,"C").Value = 350 Then Rows(i).Cells.ClearContents End If Next i -- --- HTH Bob (change the xxxx to gmail if mailing direct) "Bongard" wrote in message ups.com... I am trying to figure out how to write a macro that will delete all information in a row for columns A through O, if the current value of column c in that row = 350. I would post some of the code I have tried but it is a huge mess. I feel like this should be pretty simple. If anyone could help me out it would be much appreciated. I have been trying to use the do while ...=350 but I can't seem to get anything to work. Thanks~ |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Bob thank you for your reply. Is there any way I can do this with a do
while statement? I have to do this about 10 different times in the spreadsheet so I thought it would be easiest to do one simple do while statment for each range. Thanks, |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
As always, please do post your code so we can see that you are trying.
-- Don Guillett SalesAid Software "Bongard" wrote in message ups.com... I am trying to figure out how to write a macro that will delete all information in a row for columns A through O, if the current value of column c in that row = 350. I would post some of the code I have tried but it is a huge mess. I feel like this should be pretty simple. If anyone could help me out it would be much appreciated. I have been trying to use the do while ...=350 but I can't seem to get anything to work. Thanks~ |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() Sub RecalcReportTrial() Sheets("FASB91RecalcReport").Select Dim rng As Excel.Range For Each rng In Worksheets("FASB91RecalcReport").Range("c5:c20") If rng.Value = 350 Then rng.ClearContents 'ActiveCell.Offset(0, 2).Select End If Next This is what I am currently trying. The problem is that I can only delete the rng, and not any other cells. I would also like to use a do while statment. Thanks for your help! |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() Use Bob's or datafilterautofilter on col c for 350clear. Record a macro if desired. -- Don Guillett SalesAid Software "Bongard" wrote in message s.com... Sub RecalcReportTrial() Sheets("FASB91RecalcReport").Select Dim rng As Excel.Range For Each rng In Worksheets("FASB91RecalcReport").Range("c5:c20") If rng.Value = 350 Then rng.ClearContents 'ActiveCell.Offset(0, 2).Select End If Next This is what I am currently trying. The problem is that I can only delete the rng, and not any other cells. I would also like to use a do while statment. Thanks for your help! |
#7
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I can try and work with Bob's but it clears the contents in more than
columns a through 0. the macro must not delete anything further than column 0 because I have formulas that must be preserved. How would I stop Bob's formula from deleting that needed data? Sub trial() iLastRow = Cells(Rows.Count, "A").End(xlUp).Row For i = iLastRow To 2 Step -1 If Cells(i, "C").Value = 350 Then Rows(i).Cells.ClearContents End If Next i End Sub Once this is done for the first block I must then use a reference to get down to the next block of data and do the same thing with the value 501. Thanks for your help guys, Brian |
#8
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
range(cells(i,"a"),cells(i,"o")).clearcontents
-- Don Guillett SalesAid Software "Bongard" wrote in message ups.com... I can try and work with Bob's but it clears the contents in more than columns a through 0. the macro must not delete anything further than column 0 because I have formulas that must be preserved. How would I stop Bob's formula from deleting that needed data? Sub trial() iLastRow = Cells(Rows.Count, "A").End(xlUp).Row For i = iLastRow To 2 Step -1 If Cells(i, "C").Value = 350 Then Rows(i).Cells.ClearContents End If Next i End Sub Once this is done for the first block I must then use a reference to get down to the next block of data and do the same thing with the value 501. Thanks for your help guys, Brian |
#9
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Sub trial()
i = 2 Do While Cells(i,"C").Value < "" If Cells(i, "C").Value = 350 Then Cells(i,"C").Resize(,13).ClearContents End If i = i + 1 Loop End Sub But the other technique can be repeated throughout just as a Do Loop can. The advantage of a For ... Next loop is that the index is maintained by the loop. -- --- HTH Bob (change the xxxx to gmail if mailing direct) "Bongard" wrote in message ups.com... I can try and work with Bob's but it clears the contents in more than columns a through 0. the macro must not delete anything further than column 0 because I have formulas that must be preserved. How would I stop Bob's formula from deleting that needed data? Sub trial() iLastRow = Cells(Rows.Count, "A").End(xlUp).Row For i = iLastRow To 2 Step -1 If Cells(i, "C").Value = 350 Then Rows(i).Cells.ClearContents End If Next i End Sub Once this is done for the first block I must then use a reference to get down to the next block of data and do the same thing with the value 501. Thanks for your help guys, Brian |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
have some problem with database | Excel Discussion (Misc queries) | |||
Urgent Help Required on Excel Macro Problem | Excel Discussion (Misc queries) | |||
Problem With Reference Update | Excel Worksheet Functions | |||
Copy an Drag cell Formula Problem | Excel Discussion (Misc queries) | |||
Freeze Pane problem in shared workbooks | Excel Discussion (Misc queries) |