conditional formatting

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Conditional formatting

Conditional formatting

resolvedResolved · Medium Priority · Version 2010

Jay has attended:
Excel Intermediate course
Excel Advanced course

Conditional formatting

If i had a conditional formatting on a cell to make that row "Red" when "Yes" was in the cell.
When i run my macro the row transfers to the new sheet it is now meant to be on, but it brings the "red" color of the row with it, where i want this when transferred by marco to not be "red" know more, but be the normal color. what do i have to put into the VBA macro sheet to enable this

RE: Conditional formatting

Hi Jay

It can be done but will involve looking at the VBA code.

Unless you can speak to the person who wrote the macro it might be difficult to find the part of the macro that copies the row of data to a new sheet. If you do then copy the part of the code into your next reply and I'll take a look.

Regards

Doug
Best STL

RE: Conditional formatting

Hello,

i make the marcos

this is the example of one all are fairly similar

Sub MoveA()
Dim xrow As Long
xrow = 2
Sheets("Tickets N").Select
Dim lastrow As Long
lastrow = Cells(Rows.Count, 1).End(xlUp).Row

Do Until xrow = lastrow + 1
ActiveSheet.Cells(xrow, 22).Select
If ActiveCell.Text = "Yes" Then
Selection.EntireRow.Cut
Sheets("Tickets Y").Select
ActiveSheet.Range("lastcell3").Select
ActiveSheet.Paste
Selection.Copy
Application.CutCopyMode = False
Sheets("Tickets N").Select
ActiveCell.Select
Selection.EntireRow.Delete
xrow = xrow - 1

End If

xrow = xrow + 1
Loop
End Sub


So what bit needs to be changed?

regards

Jay

RE: Conditional formatting

Hi Jay

Try commenting out the line ActiveSheet.Paste and adding this extra line

'ActiveSheet.Paste
Selection.PasteSpecial Paste:=xlPasteValues

This should paste without copying the conditional formatting colours.



Doug
Best STL

RE: Conditional formatting

Thanks i will try this and get back to you.

Hopefully it will just removes the Conditional Formatting and nothing else.

Regards

Jay

RE: Conditional formatting

Hi, i tried to put it in, however it not liking it coming up with debug on that part, i also have other rows in there with color which transferred i want to lose the color conditional format or not

this is wat i have :

Option Explicit
Option Compare Text


Sub CallingMove()

Call MoveA
Call MoveB
Call MoveC
Call MoveD
Call MoveE
Call MoveF



End Sub



Sub MoveA()
Dim xrow As Long
xrow = 2
Sheets("Tickets N").Select
Dim lastrow As Long
lastrow = Cells(Rows.Count, 1).End(xlUp).Row

Do Until xrow = lastrow + 1
ActiveSheet.Cells(xrow, 22).Select
If ActiveCell.Text = "Yes" Then
Selection.EntireRow.Cut
Sheets("Tickets Y").Select
ActiveSheet.Range("LastCell3").Select
ActiveSheet.Paste
Selection.Copy
Application.CutCopyMode = False
Sheets("Tickets N").Select
ActiveCell.Select
Selection.EntireRow.Delete
xrow = xrow - 1

End If

xrow = xrow + 1
Loop
End Sub

Sub MoveB()
Dim xrow As Long
xrow = 2
Sheets("Tickets N").Select
Dim lastrow As Long
lastrow = Cells(Rows.Count, 1).End(xlUp).Row

Do Until xrow = lastrow + 1
ActiveSheet.Cells(xrow, 22).Select
If ActiveCell.Text = "P" Then
Selection.EntireRow.Cut
Sheets("Tickets P").Select
ActiveSheet.Range("lastcell2").Select
ActiveSheet.Paste
Selection.Copy
Application.CutCopyMode = False
Sheets("Tickets N").Select
ActiveCell.Select
Selection.EntireRow.Delete
xrow = xrow - 1

End If

xrow = xrow + 1
Loop
End Sub

Sub MoveC()
Dim xrow As Long
xrow = 2
Sheets("Tickets N").Select
Dim lastrow As Long
lastrow = Cells(Rows.Count, 1).End(xlUp).Row

Do Until xrow = lastrow + 1
ActiveSheet.Cells(xrow, 24).Select
If ActiveCell.Text = "Yes" Then
Selection.EntireRow.Cut
Sheets("Sold").Select
ActiveSheet.Range("lastcell6").Select
ActiveSheet.Paste
Selection.Copy
Application.CutCopyMode = False
Sheets("Tickets N").Select
ActiveCell.Select
Selection.EntireRow.Delete
xrow = xrow - 1

End If

xrow = xrow + 1
Loop
End Sub

Sub MoveD()
Dim xrow As Long
xrow = 2
Sheets("Tickets N").Select
Dim lastrow As Long
lastrow = Cells(Rows.Count, 1).End(xlUp).Row

Do Until xrow = lastrow + 1
ActiveSheet.Cells(xrow, 23).Select
If ActiveCell.Text = "P" Then
Selection.EntireRow.Cut
Sheets("P LMS").Select
ActiveSheet.Range("lastcell4").Select
ActiveSheet.Paste
Selection.Copy
Application.CutCopyMode = False
Sheets("Tickets N").Select
ActiveCell.Select
Selection.EntireRow.Delete
xrow = xrow - 1

End If

xrow = xrow + 1
Loop
End Sub

Sub MoveE()
Dim xrow As Long
xrow = 2
Sheets("Tickets N").Select
Dim lastrow As Long
lastrow = Cells(Rows.Count, 1).End(xlUp).Row

Do Until xrow = lastrow + 1
ActiveSheet.Cells(xrow, 23).Select
If ActiveCell.Text = "Yes" Then
Selection.EntireRow.Cut
Sheets("LMS").Select
ActiveSheet.Range("lastcell5").Select
ActiveSheet.Paste
Selection.Copy
Application.CutCopyMode = False
Sheets("Tickets N").Select
ActiveCell.Select
Selection.EntireRow.Delete
xrow = xrow - 1

End If

xrow = xrow + 1
Loop
End Sub

Sub MoveF()
Dim xrow As Long
xrow = 2
Sheets("Tickets N").Select
Dim lastrow As Long
lastrow = Cells(Rows.Count, 1).End(xlUp).Row

Do Until xrow = lastrow + 1
ActiveSheet.Cells(xrow, 37).Select
If ActiveCell.Text = "Yes" Then
Selection.EntireRow.Cut
Sheets("Paid Not Delivered").Select
ActiveSheet.Range("lastcell8").Select
ActiveSheet.Paste
Selection.Copy
Application.CutCopyMode = False
Sheets("Tickets N").Select
ActiveCell.Select
Selection.EntireRow.Delete
xrow = xrow - 1

End If

xrow = xrow + 1
Loop
End Sub


RE: Conditional formatting

Hi,

can i get a response on above

many thanks

Jay

RE: Conditional formatting

Hi,

can i get a response on above

many thanks

Jay

Will be marked as resolved in 5 days

Notice: This is an automated message. Due to inactivity, this forum post will be marked as 'resolved' if there are no further responses in the next 5 days.

Fri 15 Aug 2014: Automatically marked as resolved.

 

Training courses

 

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

Excel tip:

Customize the toolbar in Excel 2010

You can create your own toolbar which contains your favourite or most used tools. This will make using Excel much more efficient. To do this, you need to click on View, then select Customize Quick access Toolbars and then select Customize. A list of tools will then appear on the screen of which you can add or remove them as you please.

View all Excel hints and tips


Server loaded in 0.07 secs.