#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default change code

I have the below code kindly provided to me by a user of this forum

Sub deleteincomplete()
'delete all rows that have incomplete data
Dim rngToSearch As Range
Dim rngFound As Range
Dim rngFoundAll As Range
Dim strFirst As String
Dim i As Integer
For i = 1 To answer
Set rngToSearch = Sheets("cardata" & i).Columns("I") 'Change
this...
Set rngFound = rngToSearch.Find(what:="incomplete", _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
MatchCase:=False)
If Not rngFound Is Nothing Then
Set rngFoundAll = rngFound
strFirst = rngFound.Address
Do
Set rngFoundAll = Union(rngFound, rngFoundAll)
Set rngFound = rngToSearch.FindNext(rngFound)
Loop Until rngFound.Address = strFirst
rngFoundAll.EntireRow.Delete
End If
Next i

The idea is that if one of my rows that are being searched contains
"incomplete" that the whole row is deleted. I have now found I need to
keep this row, but delete where is says incomplete and enter the word
"incomplete" into column B. I then need to copy the data from columns C
+ E + G on this row into column I.

I am not sure where to start writing this code into the rngfoundAll row
in the code above.

Many thanks.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default change code

I have written this code;

rngFoundAll.Formula = "=sum(C+E+G)"
rngFoundAll.Offset(0, -7) = "incomplete"

to do the above instead of the deleterow line. However this enters this
formula into the cell;

=SUM(I:I+E+G)

and I am not sure how to solve this as obviously this returns a
circular reference, plus i need to refer to the row number in the
formula.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default change code

Thanks for your help. I had just puzzled out the below code so it's
nice to know I was on the right lines!

rngFoundAll.Formula = "=RC[-6]+RC[-4]+RC[-2]"
rngFoundAll.Offset(0, -7) = "incomplete"

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
Code Conflicts With Worksheet Change Code Paige Excel Programming 3 March 3rd 06 04:25 PM
change DAO code to ADO franco Excel Programming 1 September 13th 05 12:39 AM
VB CODE RUN ON DDE VALUE CHANGE Frank Kabel Excel Programming 1 April 1st 04 08:31 PM
VB CODE RUN ON DDE VALUE CHANGE Tom Ogilvy Excel Programming 0 April 1st 04 07:03 PM
Change to Code Chip Pearson Excel Programming 4 July 28th 03 10:54 PM


All times are GMT +1. The time now is 02:11 AM.

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"