ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   copying values in range (https://www.excelbanter.com/excel-programming/338281-copying-values-range.html)

srinivasan

copying values in range
 
Hi,

I am having a workbook containing 12 worksheets one for each month. The
closing balance of each month is to be copied as opening balance of the
following month with values only. (Range g9: g195).I have tried to record a
macro for this task but to no avail. The data has to be copied to Range ( E9
: E195). Any gentleman in the community may give an idea to accomplish this
task? Whether this code can be used to copy any range to any range (with
values only).


Tom Ogilvy

copying values in range
 
worksheets("Feb").Range("E9:E195").Value = _
worksheets("Jan").Range("G9:G195").Value

will do it.

--
Regards,
Tom Ogilvy


"srinivasan" wrote in message
...
Hi,

I am having a workbook containing 12 worksheets one for each month. The
closing balance of each month is to be copied as opening balance of the
following month with values only. (Range g9: g195).I have tried to record

a
macro for this task but to no avail. The data has to be copied to Range

( E9
: E195). Any gentleman in the community may give an idea to accomplish

this
task? Whether this code can be used to copy any range to any range (with
values only).




srinivasan

copying values in range
 
Dear Mr Tom,

I have tried your code. But it is not working for me. Pl explain me again
with detailed procedures to be adopted since I am new to VBA

Tom Ogilvy

copying values in range
 
See David McRitchie's site:
http://www.mvps.org/dmcritchie/excel/getstarted.htm


http://www.mvps.org/dmcritchie/excel....htm#tutorials

the VBA tutorial links are after the excel tutorial links.

--
Regards,
Tom Ogilvy


"srinivasan" wrote in message
...
Dear Mr Tom,

I have tried your code. But it is not working for me. Pl explain me again
with detailed procedures to be adopted since I am new to VBA




kraljb[_11_]

copying values in range
 

Sub Open_To_Close()
Dim ClosingRange As Range
Dim OpeningRange As Range
Set ClosingRange = ActiveSheet.Range("g5:g195")
Set OpeningRange = Worksheets(ActiveSheet.Index +
1).Range("e5:e195")
OpeningRange.Value = ClosingRange.Value
End Sub

Just run it ONLY when you are on the previous month (i.e. the month
with the closing range.) This is also assuming that your tabs are in
order of months.


--
kraljb
------------------------------------------------------------------------
kraljb's Profile: http://www.excelforum.com/member.php...fo&userid=9955
View this thread: http://www.excelforum.com/showthread...hreadid=399037


srinivasan

copying values in range
 
Dear Mr Kraljb,

Thanks a lot. It works nice.




All times are GMT +1. The time now is 02:53 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com