ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy formating from above row if value is entered (https://www.excelbanter.com/excel-programming/339128-copy-formating-above-row-if-value-entered.html)

Mikus

Copy formating from above row if value is entered
 
How do i copy cell's formating in column B from column B 1 row above if any
value is entered into same row's cell in column A

For example if i enter any value in cell A7 then formating (including
conditional formating) of Cell B6 should be copied to cell B7

Peter T

Copy formating from above row if value is entered
 
Try this in the Sheet module (right-click sheet-tab, view code)

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo errH
If Not Intersect(Range("A2:A65536"), Target(1)) Is Nothing Then
Application.EnableEvents = False

With Target(1)
.Offset(-1, 1).Copy
.Offset(0, 1).PasteSpecial Paste:=xlFormats
.Select
End With

End If
errH:
Application.CutCopyMode = False
Application.EnableEvents = True
End Sub

Regards,
Peter T

"Mikus" wrote in message
...
How do i copy cell's formating in column B from column B 1 row above if

any
value is entered into same row's cell in column A

For example if i enter any value in cell A7 then formating (including
conditional formating) of Cell B6 should be copied to cell B7




Mikus

Copy formating from above row if value is entered
 
This does not work !

I copied my workbook he

www.svara-kontrole.lv/Job_queue.xls

Can anyone debug this... why does this is not working ?

Example from job_queue.xls - i want to copy formating from B16 To B17 if A17
contains value.

Note A17 contains Formula, but it should not be treated as value ... i want
this to triger if there real value in A17 !

"Peter T" wrote:

Try this in the Sheet module (right-click sheet-tab, view code)

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo errH
If Not Intersect(Range("A2:A65536"), Target(1)) Is Nothing Then
Application.EnableEvents = False

With Target(1)
.Offset(-1, 1).Copy
.Offset(0, 1).PasteSpecial Paste:=xlFormats
.Select
End With

End If
errH:
Application.CutCopyMode = False
Application.EnableEvents = True
End Sub

Regards,
Peter T

"Mikus" wrote in message
...
How do i copy cell's formating in column B from column B 1 row above if

any
value is entered into same row's cell in column A

For example if i enter any value in cell A7 then formating (including
conditional formating) of Cell B6 should be copied to cell B7






All times are GMT +1. The time now is 12:42 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com