Copy paste value only

fireslguk

Active Member
Joined
Nov 11, 2005
Messages
305
I have 5 sheets

Sheet 1 range A1 contains =now()

I want on pressing a button to paste the value only of this to B1 on all other 4 sheets which are protected

I then want the sheets to re protect
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
hello fireslguk,

without via code, you can try this...

Get the value from Sheet1 cell A1
Unprotect the other 4 sheets
Paste the value to cell B1 on each of the other 4 sheets
Re-protect the 4 sheets

a bit more effort if a macro is drafted to handle this

hope this helps
plettieri
 
Upvote 0
hello fireslguk,

without via code, you can try this...

Get the value from Sheet1 cell A1
Unprotect the other 4 sheets
Paste the value to cell B1 on each of the other 4 sheets
Re-protect the 4 sheets

a bit more effort if a macro is drafted to handle this

hope this helps
plettieri
Thankyou need it to be code so does all in one hit
 
Upvote 0
See if this is close to what you are after:

VBA Code:
Sub DateTimeStampSheets()

    Dim thisWS As Worksheet
    Dim ws As Worksheet
    Dim dt As Date
    
    Set thisWS = ActiveSheet
    dt = thisWS.Range("A1").Value2
    
    For Each ws In ActiveWorkbook.Worksheets
        If ws.Name <> thisWS.Name  Then
            With ws
                .Unprotect Password:=123
                .Range("B1").Value2 = dt
                .Protect Password:=123, DrawingObjects:=True, Contents:=True, Scenarios:=True
            End With
        End If
    Next ws
End Sub
 
Upvote 0
See if this is close to what you are after:

VBA Code:
Sub DateTimeStampSheets()

    Dim thisWS As Worksheet
    Dim ws As Worksheet
    Dim dt As Date
   
    Set thisWS = ActiveSheet
    dt = thisWS.Range("A1").Value2
   
    For Each ws In ActiveWorkbook.Worksheets
        If ws.Name <> thisWS.Name  Then
            With ws
                .Unprotect Password:=123
                .Range("B1").Value2 = dt
                .Protect Password:=123, DrawingObjects:=True, Contents:=True, Scenarios:=True
            End With
        End If
    Next ws
End Sub
Some manipulation required to the code above my head

I have 10 sheets

Only want sheets “s1”, “s2”, “s3”, “s4”, “s5” b1 to receive this value from sheet “Main”
 
Upvote 0
Try:
VBA Code:
Sub DateTimeStampSheets()

    Dim thisWS As Worksheet
    Dim ws As Worksheet
    Dim dt As Date
  
    Set thisWS = Worksheets("Main")
    dt = thisWS.Range("A1").Value2
  
    For Each ws In ActiveWorkbook.Worksheets
        Select Case ws.Name
      
            Case "s1", "s2", "s3", "s4", "s5"
                With ws
                    .Unprotect Password:=123
                    .Range("B1").Value2 = dt
                    .Protect Password:=123, DrawingObjects:=True, Contents:=True, Scenarios:=True
                End With
            End Select
          
    Next ws
End Sub
 
Last edited:
Upvote 0
Try:
VBA Code:
Sub DateTimeStampSheets()

    Dim thisWS As Worksheet
    Dim ws As Worksheet
    Dim dt As Date
    
    Set thisWS = Worksheets("Main")
    dt = thisWS.Range("A1").Value2
    
    For Each ws In ActiveWorkbook.Worksheets
        Select Case ws.Name
        
            Case "s1", "s2", "s3", "s4", "s5"
                With ws
                    .Unprotect Password:=123
                    .Range("B1").Value2 = dt
                    .Protect Password:=123, DrawingObjects:=True, Contents:=True, Scenarios:=True
                End With
            Case "dashboard"
                    .Unprotect Password:=123
                    .Range("O5").Value2 = dt
                    .Protect Password:=123, DrawingObjects:=True, Contents:=True, Scenarios:=True
            End Select
            
    Next ws
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,609
Messages
6,179,875
Members
452,949
Latest member
Dupuhini

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