All cells in code specified alter cell color apart from one

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,251
Office Version
  1. 2007
Platform
  1. Windows
Afternoon all,
I am using the code shown below to copy the data from HONDA SHEET A17:G17 to HONDA LIST A4:G4
This happens after i make my selection from a drop list down in cell F17

Code:
Sub sheettolist()'
' sheettolist Macro
Sheets("HONDA SHEET").Range("A17:G17").Copy
Sheets("HONDA LIST").Range("A4").Insert Shift:=xlDown
Application.CutCopyMode = False
Sheets("HONDA LIST").Range("A4").Characters(Start:=10, Length:=1).Font.ColorIndex = 3
ActiveWorkbook.Save
Sheets("HONDA SHEET").Range("A13").Select
End Sub

On the HONDA LIST worksheet is the code shown below which highlights the rows A4;G4 so its more easier for me to see the data within the cells.
Code:
Private Sub SortVinButton_Click()    
    Dim x As Long
    
    Application.ScreenUpdating = False
    
    With Sheets("HONDA LIST")
        If .AutoFilterMode Then .AutoFilterMode = False
        x = .Cells(.Rows.Count, 1).End(xlUp).Row
        
        .Range("A3:G" & x).Sort Key1:=Range("A4"), Order1:=xlAscending, Header:=xlGuess
    
    End With
                      
    ActiveWorkbook.Save
    
    Application.ScreenUpdating = True
    Sheets("HONDA LIST").Range("A4").Select
    
End Sub

The above works well apart from the cell F4 on HONDA LIST worksheet doesnt change color where the other cells in Row 4 do.

Do you see an issue as to why or maybe advise an edit to force it to work.

Many thanks.
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Neither of your codes, is highlighting anything.
The top code changes the 10th character in A4 to red, but that's it.
I suspect that you either have conditional formatting, or another macro.
 
Upvote 0
My mistake as second code was wrong.

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)    Dim myStartCol As String
    Dim myEndCol As String
    Dim myStartRow As Long
    Dim myLastRow As Long
    Dim myRange As Range


    If Target.Cells.Count > 1 Then Exit Sub
    
    Application.ScreenUpdating = False
    
'   *** Specify columns to apply this to ***
    myStartCol = "A"
    myEndCol = "G"


'   *** Specify start row ***
    myStartRow = 4
    
'   Use first column to find the last row
    myLastRow = Cells(Rows.Count, myStartCol).End(xlUp).Row
    
'   Build range to apply this to
    Set myRange = Range(Cells(myStartRow, myStartCol), Cells(myLastRow, myEndCol))
    
'   Clear the color of all the cells in range
    myRange.Interior.ColorIndex = 6
    
'   Check to see if cell selected is outside of range
    If Intersect(Target, myRange) Is Nothing Then Exit Sub
    
'   Highlight the row and column that contain the active cell
    Range(Cells(Target.Row, myStartCol), Cells(Target.Row, myEndCol)).Interior.ColorIndex = 8
Target.Interior.Color = vbGreen
    Application.ScreenUpdating = True


End Sub
 
Upvote 0
The above works well apart from the cell F4 on HONDA LIST worksheet doesnt change color where the other cells in Row 4 do.

Do you see an issue as to why or maybe advise an edit to force it to work.
Without looking at your code at all, one possibility comes to mind... do you have any Conditional Formatting rules set for cell F4 and, if so, is that cell meeting the criteria you have set for it Conditional Format? If so, you should be aware that Conditional Formatting always wins out over any manual format you set for a cell.
 
Upvote 0
Your code seems to work for me.
Do you have any merged cells?
Do you have any conditional formatting?
 
Upvote 0
I would say no to both your questions.

Its strange.

In total i have 3 issues but cant seem to find the answers at all.
Trying to run with it is ok but need it sorted to be honest.
 
Upvote 0
Without being able to see you sheet, there's not much more I can do unfortunately. :(
 
Upvote 0
Here is the file for download.
http://www.mediafire.com/file/1zlv615srur663t/SHARING.zip

The issues that i have.

Database tab,Select line button,enter date in cell M6, when you leave that cell the date changes/reverses itself,ex 03/12/2017 changes to 12/03/2017

The issue mentioned on this post where after the copy/paste takes place,cell F4 does not change color on HONDA LIST worksheet.

Honda Sheet tab, i paste 17 characters into cell A13, this then is transfered to cell A17, now the cell has this value i need the 10th character to be red, i would of liked it so when i then tab across to cell B17 it then changes to red in cell A17 or even have it change to red once its pasted there.
Currently i have working for when i save or make my selecting in cell F17

Many Thanks
 
Upvote 0
I did not experience the issue you are reporting regards the Honda List sheet, so cannot help with that.
The date is changing to American format because of the change event. Put a check in to prevent it running on that column.
you can take the code that makes the 10th from your sheettolist macro & add to the change event code.
 
Upvote 0
Hi,
Checking the format cell info on the date cell i see its set to English and also shows like 03/12/2017 etc.
Did you mean its elsewhere ?

Can you advise also where in my code i need to add the sheettolist info.

Many thanks
 
Upvote 0

Forum statistics

Threads
1,215,781
Messages
6,126,861
Members
449,345
Latest member
CharlieDP

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top