RE: Formula help

Bazola

New Member
Joined
Mar 14, 2018
Messages
34
Office Version
  1. 365
Platform
  1. Windows
RE: Formula help

Hi All

I need some help with something if you dont mind..

Basically I have a cell that if it contains the text "Yes" it will enter todays date in the cell next to it. I also need it to copy data from one cell into another at the same time but take the values only, not the formula.

Thanks in advance.

Baz
 
Re: Formula help

Hi All

I need some help with the Macro side if you dont mind, I have a Cell H3, which when I type Yes, it automatically fills in the cell next to it I3 with todays date "=IF(H3="Yes",TODAY(),"")" - this isnt a macro. However I need when I type "Yes" into H3 for it to automatically copy the content from G3 and paste it to cell J3 but with values only. Once this works, I need this for a range H3:H59 and the same for J3:J59.

I really hope you can help as this is the final piece I need to sort :)
 
Upvote 0

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Re: Formula help

Hi, you could try this event code - to use, right click the sheet where you want these actions to occur and choose "View Code" and paste the code below into the window that opens up and save the workbook as a macro enabled workbook (.XLSM)

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim R As Range, C As Range
Set R = Intersect(Range("H3:H59"), Target)
    If Not R Is Nothing Then
        Application.EnableEvents = False
        For Each C In R
            If UCase(C.Value) = "YES" Then
                C.Offset(, 1).Value = Date
                C.Offset(, 2).Value = C.Offset(, -1).Value
            End If
        Next C
        Application.EnableEvents = True
    End If
End Sub
 
Upvote 0
Re: Formula help

How would I combine the following into the code you provided above? Basically, once i've entered "Yes" in H3, I want to fill in the info as per what you've already provided but then lock the cell and the spreadsheet as I have put in the code below. Just not sure how to combine them,

Private Sub Worksheet_Change(ByVal Target As Range)
Dim MyRange As Range

Set MyRange = Intersect(Range("H3:H999"), Target)
If Not MyRange Is Nothing Then
Sheets("Sheet1").Unprotect password:="hello"
MyRange.Locked = True
Sheets("Sheet1").Protect password:="hello"
End If
End Sub
 
Upvote 0
Re: Formula help

Hi, something like this maybe..

Rich (BB code):
Private Sub Worksheet_Change(ByVal Target As Range)
Dim R As Range, C As Range
Set R = Intersect(Range("H3:H59"), Target)
    If Not R Is Nothing Then
        Application.EnableEvents = False
        Me.Unprotect Password:="hello"
        For Each C In R
            If UCase(C.Value) = "YES" Then
                C.Offset(, 1).Value = Date
                C.Offset(, 2).Value = C.Offset(, -1).Value
                C.Locked = True
            End If
        Next C
        Me.Protect Password:="hello"
        Application.EnableEvents = True
    End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,187
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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