How can i write macro so that it will conditional format?

October 11, 2016 at 09:44:58
Specs: Windows 7
I would like to know how to write macros to conditionally format the entire row with red color, If i press "NO" in A2 cell.
Adding to this, if i click the macro button then (start & end time) system time should be entered into the cell, once end time done that cell should be frozen.

See More: How can i write macro so that it will conditional format?

Reply ↓  Report •


#1
October 11, 2016 at 17:59:54
I don't know what you mean by "If i press "NO" in A2 cell". Do you mean enter NO in A2?

I also don't know what you mean by "if i click the macro button then (start & end time) system time should be entered into the cell".

Start and end time of what?
Are you expecting a single cell to contain both times?
What cell (or cells) should these times be entered into?

Please explain your requirements in a some more detail and we'll try to help.

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.


Reply ↓  Report •

#2
October 11, 2016 at 20:54:00
Hi,
Briefing my queries, once I enter particular value in any of the cell then the entire row should be changed in RED format.
Macros should be enabled in a button, once I click that button then it should hit current system in selected cell. Once done it shouldn't be editable manually.(in A row start time to be entered & B row end time)

Reply ↓  Report •

#3
October 12, 2016 at 04:12:52
You are saying 2 different things.

In one case you say that the row should be formatted in red "once I enter a particular value" and in the other case you say you want to row formatted in red when you click a macro button. Do you know that the macro can be run automatically as soon as you enter the value? Do you want that to happen or do want to have to click a button?

As far as the "start and end time", the formatting of the row is going to be essentially instantaneous, so the start time is going to be the same as the end time. Please explain the need for a start and end time.

Finally, in your OP you said that you were entering the value in A2. Now you say you want the start time in Column A. Are you saying that you want the time to overwrite the value that you entered in Column A?

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.


Reply ↓  Report •

Related Solutions

#4
October 13, 2016 at 01:17:57
Hi,

Macro should run automatically as soon as I enter the value(No).
For second query, I want a macro button which enables to enter current system time. Leave those input cells. Please advice me the macro code generically then I will make a change as required


Reply ↓  Report •

#5
October 13, 2016 at 12:59:02
For the "Red Row":

Right click the sheet tab for the sheet you want the "red row" in and choose View Code. Paste this code into the pane that opens. If you enter any version of "NO" (NO, no, etc.) in Column A, the entire Row will be filled with Red.

Private Sub Worksheet_Change(ByVal Target As Range)
 If Target.Column = 1 Then
   If UCase(Target) = "NO" Then
    Target.EntireRow.Interior.ColorIndex = 3
   End If
 End If
End Sub

For the System Time:

Attach this code to a macro button. When the button is clicked, the system time will be placed in A1:

Sub SysTime()
 Cells(1, 1) = Time
End Sub

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.


Reply ↓  Report •


Ask Question