Enter into cell to fill with yellow & also enter specific text in another cell.
-
QUESTION: Do you know if it possible to achieve the following in anspreadsheet: ..... Just by clicking on cell A1, the current time [ Time()] is automatically entered into cell B1 - this function would then apply to Cells A2/B2, A3/B3 and so on. Rod Whitehouse. - ANSWER: Rod Whitehouse, right click on the sheet tab where you want this behavior and select View Code. in the resulting module, paste in code like this: Private Sub Worksheet_Change(ByVal Target As Range) If Target.Count > 1 Then Exit Sub If Len(Trim(Target.Text)) = 0 Then Exit Sub If Target.Column = 1 Then With Target.Offset(0, 1) .Value = Time() .NumberFormat = "hh:mm:ss AM/PM" End With End If End Sub ---------- FOLLOW-UP ---------- QUESTION: Thankyou for last solution (Re: ¡°Just by clicking on cell A1¡±) - Do you know if it possible to achieve the following in anspreadsheet: ..... Just by entering the following text: ¡°Monday¡± in cell A1, the current time [ Time()] is automatically entered into cell B1 - this function would then apply to Cells A2/B2, A3/B3 and so on. Rod Whitehouse. - ANSWER: Rod Whitehouse I believe I misread you original question. You said click on cell A1 and I interpreted that to mean you made an entry/edited in A1 since that is the more common question. And that is the answer I gave you. You now appear to be asking for the more common situation - but you said enter Monday in A1. So this code works for any enteries in column A Private Sub Worksheet_Change(ByVal Target As Range) If Target.Count > 1 Then Exit Sub If Len(Trim(Target.Text)) = 0 Then Exit Sub If Target.Column = 1 Then With Target.Offset(0, 1) .Value = Time() .NumberFormat = "hh:mm:ss AM/PM" End With End If End Sub if you only want the time if you enter MONDAY in column A then Private Sub Worksheet_Change(ByVal Target As Range) If Target.Count > 1 Then Exit Sub If Len(Trim(Target.Text)) = 0 Then Exit Sub If Target.Column = 1 Then if Instr(1,Target,"Monday",vbTextcompare) then With Target.Offset(0, 1) .Value = Time() .NumberFormat = "hh:mm:ss AM/PM" End With End if End If End Sub so that version will only put in the time where you enter theMonday in column A. Hopefully that is what you want. If you still want code for just click in a cell in column A whether you make an entry or not, then post a followup to this and I will work that up for you. ---------- FOLLOW-UP ---------- QUESTION: Do you know if it possible to achieve the following in anspreadsheet: .... Using a target value of 2 (If Target.Value = 2 Then) By entering cell L1, cell L1 then fills with yellow and the following text ¡°Monday¡± is then entered into cell G1 Rod Whitehouse. -
-
Answer:
Rod Whitehouse, when you say target value are you refering to a Change event that has Target as an argument. If so, then Target could refer to anycell on the worksheet. I would guess you only want to take this action if a specific cell has a value of 2. So I will assume this is what you want: if someone types 2 in cell J1 (I made this up since you didn't say what target is when you want the action taken), then L1 will be selected and filled with yellow and G1 will receive the entry "Monday" Private Sub Worksheet_Change(ByVal Target As Range) If Target.Count > 1 Then Exit Sub If Len(Trim(Target.Text)) = 0 Then Exit Sub If Target.Address = "$J$1" then If Target.Value = 2 then ' Select L1 and fill it with yellow??? me.Range("L1").Select me.Range("L1").Interior.ColorIndex = 3 ' Put Monday in cell G1 me.Range("G1").Value = "Monday" End if End if End Sub this would be in the worksheet module.
Miningco.com Visit the source
Related Q & A:
- How to split column text to another column?Best solution by Stack Overflow
- How to extract a specific text from an image?Best solution by Stack Overflow
- Is it possible to change the color of the Web Search button from yellow to another one?Best solution by Yahoo! Answers
- How to make a picture the fill of text?Best solution by Quora
- How do I text to a cell phone number?Best solution by ChaCha
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.