OzGrid

How to copy cell data to another sheet and save it automatically

< Back to Search results

 Category: [Excel]  Demo Available 

How to copy cell data to another sheet and save it automatically:

 

This  VBA code enables the copying of cell data to another sheet and automatic saving
or
if condition is met then take a screen shot and past it to sheet or save it as pic automatically.

 
Code:
Sub UpdateData()
If Hour(Time) >= 3 And Minute(Time) >= 1 Then
Application.OnTime Now + TimeValue("0:0:5"), "UpdateData", False
Else
Application.OnTime Now + TimeValue("0:0:5"), "UpdateData"
CopyData
End If
End Sub
Sub CopyData()
Dim sht1 As Worksheet
Dim sht2 As Worksheet
Dim cRng As Range
Dim dCol As Long
Set sht1 = ThisWorkbook.Sheets("Sheet1")
Set sht2 = ThisWorkbook.Sheets("Sheet2")
Set cRng = sht1.Range("Bu1:bu8")
dCol = sht2.Cells(2, Columns.Count).End(xlToLeft).Column + 1
sht2.Range(Cells(2, dCol).Address, Cells(8, dCol + 1).Address) = cRng.Value
End Sub

Obtained from the OzGrid Help Forum.

Written by royUK.

 

See also: Index to Excel VBA Code and Index to Excel Freebies and Lesson 1 - Excel Fundamentals and Index to how to… providing a range of solutions and Index to new resources and reference sheets

 

See also:

How to use a Macro to copy rows from multiple worksheets based on a cell value greater than zero
How to copy last used row to next empty row in another worksheet

How to copy and paste when criteria is met

How to copy information from an excel sheet to a word document
How to copy cell value on Sheet 1 to a location in a text in another cell on Sheet 2

 

Click here to visit our Free 24/7 Excel/VBA Help Forum where there are thousands of posts you can get information from, or you can join the Forum and post your own questions.


Gallery



stars (0 Reviews)