Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 422
Default Can't recreate A Macro

At the office yesterday I created a macro << which worked; now that I'm
home
I can't seem to re-create it,,, why I didn't mail my self a copy I don't
know...
Anyway

It worked as follows:

I have a data table say A5:F50,
I could select (highlight) a single column range, (always Col c) so --
C5:C50
Run the Macro which would delete the entire row of only cells (in Col C)
with interior.colorindex = 6.

Can someone help me re-create?
TIA,



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Can't recreate A Macro

Try this one

Sub Example3()
Dim Lrow As Long
Dim CalcMode As Long
Dim StartRow As Long
Dim EndRow As Long
With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With

With ActiveSheet
.DisplayPageBreaks = False
StartRow = 5
EndRow = .Cells(.Rows.Count, "C").End(xlUp).Row
For Lrow = EndRow To StartRow Step -1
If IsError(.Cells(Lrow, "C").Value) Then
'Do nothing, This avoid a error if there is a error in the cell

ElseIf .Cells(Lrow, "C").Interior.ColorIndex = 6 Then .Rows(Lrow).Delete
End If
Next
End With
With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"JMay" wrote in message news:rbSdc.9193$192.4538@lakeread06...
At the office yesterday I created a macro << which worked; now that I'm
home
I can't seem to re-create it,,, why I didn't mail my self a copy I don't
know...
Anyway

It worked as follows:

I have a data table say A5:F50,
I could select (highlight) a single column range, (always Col c) so --
C5:C50
Run the Macro which would delete the entire row of only cells (in Col C)
with interior.colorindex = 6.

Can someone help me re-create?
TIA,





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 422
Default Can't recreate A Macro

Ron!! That's Great Thanks a lot..!!

"Ron de Bruin" wrote in message
...
Try this one

Sub Example3()
Dim Lrow As Long
Dim CalcMode As Long
Dim StartRow As Long
Dim EndRow As Long
With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With

With ActiveSheet
.DisplayPageBreaks = False
StartRow = 5
EndRow = .Cells(.Rows.Count, "C").End(xlUp).Row
For Lrow = EndRow To StartRow Step -1
If IsError(.Cells(Lrow, "C").Value) Then
'Do nothing, This avoid a error if there is a error in the

cell

ElseIf .Cells(Lrow, "C").Interior.ColorIndex = 6 Then

..Rows(Lrow).Delete
End If
Next
End With
With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"JMay" wrote in message

news:rbSdc.9193$192.4538@lakeread06...
At the office yesterday I created a macro << which worked; now that

I'm
home
I can't seem to re-create it,,, why I didn't mail my self a copy I don't
know...
Anyway

It worked as follows:

I have a data table say A5:F50,
I could select (highlight) a single column range, (always Col c)

o --
C5:C50
Run the Macro which would delete the entire row of only cells (in Col C)
with interior.colorindex = 6.

Can someone help me re-create?
TIA,







  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Can't recreate A Macro

Just as an aside, I too often create some code and don't save it (for
various reasons). What I tend to find is that, whilst I can usually recall
what I did relatively clearly and so can quickly re-create, this often has a
beneficial effect that upon re-entering I start to think again about the
design/layout/whatever you wish to call it, and often leads to (IMO) a
better piece of code second (or even third) time around.

I guess it is a bit like re-visiting your code, it is always easy to
criticise it and see ways to improve a finished or semi-finished product.

Not advocating this as a development approach of course<vbg.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Ron de Bruin" wrote in message
...
Try this one

Sub Example3()
Dim Lrow As Long
Dim CalcMode As Long
Dim StartRow As Long
Dim EndRow As Long
With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With

With ActiveSheet
.DisplayPageBreaks = False
StartRow = 5
EndRow = .Cells(.Rows.Count, "C").End(xlUp).Row
For Lrow = EndRow To StartRow Step -1
If IsError(.Cells(Lrow, "C").Value) Then
'Do nothing, This avoid a error if there is a error in the

cell

ElseIf .Cells(Lrow, "C").Interior.ColorIndex = 6 Then

..Rows(Lrow).Delete
End If
Next
End With
With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"JMay" wrote in message

news:rbSdc.9193$192.4538@lakeread06...
At the office yesterday I created a macro << which worked; now that

I'm
home
I can't seem to re-create it,,, why I didn't mail my self a copy I don't
know...
Anyway

It worked as follows:

I have a data table say A5:F50,
I could select (highlight) a single column range, (always Col c)

o --
C5:C50
Run the Macro which would delete the entire row of only cells (in Col C)
with interior.colorindex = 6.

Can someone help me re-create?
TIA,







  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 422
Default Can't recreate A Macro

Ron, as a learning experience I've tried modifying the code and at present
have it
as follows; << It isn't working, but could you comment on what is
apparently wrong
TIA

Sub DeleteYellowRow()
Dim Lrow As Long
Dim StartRow As Long
Dim EndRow As Long
With Selection ' prior to running macro I've Selected C4:C16 say
StartRow = Selection(1).Row
EndRow = StartRow + Selection.Rows.Count - 1
For Lrow = EndRow To StartRow Step -1
If .Cells(Lrow, "C").Interior.ColorIndex = 6 Then
Cells(Lrow, 3).EntireRow.Delete
End If
Next
End With
End Sub

"Ron de Bruin" wrote in message
...
Try this one

Sub Example3()
Dim Lrow As Long
Dim CalcMode As Long
Dim StartRow As Long
Dim EndRow As Long
With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With

With ActiveSheet
.DisplayPageBreaks = False
StartRow = 5
EndRow = .Cells(.Rows.Count, "C").End(xlUp).Row
For Lrow = EndRow To StartRow Step -1
If IsError(.Cells(Lrow, "C").Value) Then
'Do nothing, This avoid a error if there is a error in the

cell

ElseIf .Cells(Lrow, "C").Interior.ColorIndex = 6 Then

..Rows(Lrow).Delete
End If
Next
End With
With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"JMay" wrote in message

news:rbSdc.9193$192.4538@lakeread06...
At the office yesterday I created a macro << which worked; now that

I'm
home
I can't seem to re-create it,,, why I didn't mail my self a copy I don't
know...
Anyway

It worked as follows:

I have a data table say A5:F50,
I could select (highlight) a single column range, (always Col c)

o --
C5:C50
Run the Macro which would delete the entire row of only cells (in Col C)
with interior.colorindex = 6.

Can someone help me re-create?
TIA,









  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Can't recreate A Macro

Hi JMay

What are you trying to do?
Do you want to make a macro that is also working for the selection
no matter what column you select.



--
Regards Ron de Bruin
http://www.rondebruin.nl


"JMay" wrote in message news:AsYdc.9644$192.6092@lakeread06...
Ron, as a learning experience I've tried modifying the code and at present
have it
as follows; << It isn't working, but could you comment on what is
apparently wrong
TIA

Sub DeleteYellowRow()
Dim Lrow As Long
Dim StartRow As Long
Dim EndRow As Long
With Selection ' prior to running macro I've Selected C4:C16 say
StartRow = Selection(1).Row
EndRow = StartRow + Selection.Rows.Count - 1
For Lrow = EndRow To StartRow Step -1
If .Cells(Lrow, "C").Interior.ColorIndex = 6 Then
Cells(Lrow, 3).EntireRow.Delete
End If
Next
End With
End Sub

"Ron de Bruin" wrote in message
...
Try this one

Sub Example3()
Dim Lrow As Long
Dim CalcMode As Long
Dim StartRow As Long
Dim EndRow As Long
With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With

With ActiveSheet
.DisplayPageBreaks = False
StartRow = 5
EndRow = .Cells(.Rows.Count, "C").End(xlUp).Row
For Lrow = EndRow To StartRow Step -1
If IsError(.Cells(Lrow, "C").Value) Then
'Do nothing, This avoid a error if there is a error in the

cell

ElseIf .Cells(Lrow, "C").Interior.ColorIndex = 6 Then

.Rows(Lrow).Delete
End If
Next
End With
With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"JMay" wrote in message

news:rbSdc.9193$192.4538@lakeread06...
At the office yesterday I created a macro << which worked; now that

I'm
home
I can't seem to re-create it,,, why I didn't mail my self a copy I don't
know...
Anyway

It worked as follows:

I have a data table say A5:F50,
I could select (highlight) a single column range, (always Col c)

o --
C5:C50
Run the Macro which would delete the entire row of only cells (in Col C)
with interior.colorindex = 6.

Can someone help me re-create?
TIA,









  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 422
Default Can't recreate A Macro

Yes!!

"Ron de Bruin" wrote in message
...
Hi JMay

What are you trying to do?
Do you want to make a macro that is also working for the selection
no matter what column you select.



--
Regards Ron de Bruin
http://www.rondebruin.nl


"JMay" wrote in message

news:AsYdc.9644$192.6092@lakeread06...
Ron, as a learning experience I've tried modifying the code and at

present
have it
as follows; << It isn't working, but could you comment on what is
apparently wrong
TIA

Sub DeleteYellowRow()
Dim Lrow As Long
Dim StartRow As Long
Dim EndRow As Long
With Selection ' prior to running macro I've Selected C4:C16 say
StartRow = Selection(1).Row
EndRow = StartRow + Selection.Rows.Count - 1
For Lrow = EndRow To StartRow Step -1
If .Cells(Lrow, "C").Interior.ColorIndex = 6 Then
Cells(Lrow, 3).EntireRow.Delete
End If
Next
End With
End Sub

"Ron de Bruin" wrote in message
...
Try this one

Sub Example3()
Dim Lrow As Long
Dim CalcMode As Long
Dim StartRow As Long
Dim EndRow As Long
With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With

With ActiveSheet
.DisplayPageBreaks = False
StartRow = 5
EndRow = .Cells(.Rows.Count, "C").End(xlUp).Row
For Lrow = EndRow To StartRow Step -1
If IsError(.Cells(Lrow, "C").Value) Then
'Do nothing, This avoid a error if there is a error in

the
cell

ElseIf .Cells(Lrow, "C").Interior.ColorIndex = 6 Then

.Rows(Lrow).Delete
End If
Next
End With
With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"JMay" wrote in message

news:rbSdc.9193$192.4538@lakeread06...
At the office yesterday I created a macro << which worked; now

that
I'm
home
I can't seem to re-create it,,, why I didn't mail my self a copy I

don't
know...
Anyway

It worked as follows:

I have a data table say A5:F50,
I could select (highlight) a single column range, (always Col c)

o --
C5:C50
Run the Macro which would delete the entire row of only cells (in

Col C)
with interior.colorindex = 6.

Can someone help me re-create?
TIA,











  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Can't recreate A Macro

Try this

Sub DeleteYellowRow()
Dim Lrow As Long
Dim StartRow As Long
Dim EndRow As Long

If Selection.Columns.Count 1 Then Exit Sub
' stop the macro if you select more then one column

With Selection
StartRow = Selection.Cells(1).Row
EndRow = StartRow + Selection.Rows.Count - 1
For Lrow = EndRow To StartRow Step -1
If Cells(Lrow, Selection.Column).Interior.ColorIndex = 6 Then
Cells(Lrow, Selection.Column).EntireRow.Delete
End If
Next
End With
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"JMay" wrote in message news:3OYdc.9646$192.1282@lakeread06...
Yes!!

"Ron de Bruin" wrote in message
...
Hi JMay

What are you trying to do?
Do you want to make a macro that is also working for the selection
no matter what column you select.



--
Regards Ron de Bruin
http://www.rondebruin.nl


"JMay" wrote in message

news:AsYdc.9644$192.6092@lakeread06...
Ron, as a learning experience I've tried modifying the code and at

present
have it
as follows; << It isn't working, but could you comment on what is
apparently wrong
TIA

Sub DeleteYellowRow()
Dim Lrow As Long
Dim StartRow As Long
Dim EndRow As Long
With Selection ' prior to running macro I've Selected C4:C16 say
StartRow = Selection(1).Row
EndRow = StartRow + Selection.Rows.Count - 1
For Lrow = EndRow To StartRow Step -1
If .Cells(Lrow, "C").Interior.ColorIndex = 6 Then
Cells(Lrow, 3).EntireRow.Delete
End If
Next
End With
End Sub

"Ron de Bruin" wrote in message
...
Try this one

Sub Example3()
Dim Lrow As Long
Dim CalcMode As Long
Dim StartRow As Long
Dim EndRow As Long
With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With

With ActiveSheet
.DisplayPageBreaks = False
StartRow = 5
EndRow = .Cells(.Rows.Count, "C").End(xlUp).Row
For Lrow = EndRow To StartRow Step -1
If IsError(.Cells(Lrow, "C").Value) Then
'Do nothing, This avoid a error if there is a error in

the
cell

ElseIf .Cells(Lrow, "C").Interior.ColorIndex = 6 Then
.Rows(Lrow).Delete
End If
Next
End With
With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"JMay" wrote in message
news:rbSdc.9193$192.4538@lakeread06...
At the office yesterday I created a macro << which worked; now

that
I'm
home
I can't seem to re-create it,,, why I didn't mail my self a copy I

don't
know...
Anyway

It worked as follows:

I have a data table say A5:F50,
I could select (highlight) a single column range, (always Col c)
o --
C5:C50
Run the Macro which would delete the entire row of only cells (in

Col C)
with interior.colorindex = 6.

Can someone help me re-create?
TIA,













  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 422
Default Can't recreate A Macro

Ron:
I appreciate your assistance in both cases. I've printed out the code of
both versions and plan on getting far away from my computer to compare,
study and hopefully understand.
Thanks again for your help..

"Ron de Bruin" wrote in message
...
Try this

Sub DeleteYellowRow()
Dim Lrow As Long
Dim StartRow As Long
Dim EndRow As Long

If Selection.Columns.Count 1 Then Exit Sub
' stop the macro if you select more then one column

With Selection
StartRow = Selection.Cells(1).Row
EndRow = StartRow + Selection.Rows.Count - 1
For Lrow = EndRow To StartRow Step -1
If Cells(Lrow, Selection.Column).Interior.ColorIndex = 6 Then
Cells(Lrow, Selection.Column).EntireRow.Delete
End If
Next
End With
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"JMay" wrote in message

news:3OYdc.9646$192.1282@lakeread06...
Yes!!

"Ron de Bruin" wrote in message
...
Hi JMay

What are you trying to do?
Do you want to make a macro that is also working for the selection
no matter what column you select.



--
Regards Ron de Bruin
http://www.rondebruin.nl


"JMay" wrote in message

news:AsYdc.9644$192.6092@lakeread06...
Ron, as a learning experience I've tried modifying the code and at

present
have it
as follows; << It isn't working, but could you comment on what is
apparently wrong
TIA

Sub DeleteYellowRow()
Dim Lrow As Long
Dim StartRow As Long
Dim EndRow As Long
With Selection ' prior to running macro I've Selected C4:C16

say
StartRow = Selection(1).Row
EndRow = StartRow + Selection.Rows.Count - 1
For Lrow = EndRow To StartRow Step -1
If .Cells(Lrow, "C").Interior.ColorIndex = 6 Then
Cells(Lrow, 3).EntireRow.Delete
End If
Next
End With
End Sub

"Ron de Bruin" wrote in message
...
Try this one

Sub Example3()
Dim Lrow As Long
Dim CalcMode As Long
Dim StartRow As Long
Dim EndRow As Long
With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With

With ActiveSheet
.DisplayPageBreaks = False
StartRow = 5
EndRow = .Cells(.Rows.Count, "C").End(xlUp).Row
For Lrow = EndRow To StartRow Step -1
If IsError(.Cells(Lrow, "C").Value) Then
'Do nothing, This avoid a error if there is a

error in
the
cell

ElseIf .Cells(Lrow, "C").Interior.ColorIndex = 6 Then
.Rows(Lrow).Delete
End If
Next
End With
With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"JMay" wrote in message
news:rbSdc.9193$192.4538@lakeread06...
At the office yesterday I created a macro << which worked; now

that
I'm
home
I can't seem to re-create it,,, why I didn't mail my self a copy

I
don't
know...
Anyway

It worked as follows:

I have a data table say A5:F50,
I could select (highlight) a single column range, (always Col c)
o --
C5:C50
Run the Macro which would delete the entire row of only cells

(in
Col C)
with interior.colorindex = 6.

Can someone help me re-create?
TIA,















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
How can i recreate a list without errors Bretter99 Excel Worksheet Functions 0 December 14th 07 12:30 PM
How do I force Excel to recreate links it lost in conversion. Rod Excel Discussion (Misc queries) 0 March 23rd 07 04:04 PM
Can excel read my old lotus 123 files or will I have to recreate? R P Kief Excel Discussion (Misc queries) 1 March 28th 06 04:16 AM
Recreate the upper part of a symetric data matrix 75x75 Michael Cantinotti Excel Discussion (Misc queries) 4 May 23rd 05 05:04 PM
Recreate a macro menu sdyman Excel Programming 2 February 20th 04 09:09 PM


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