![]() |
Can this be done?
Hi, I was wondering if i could take a simple bit of code and assign it to a varriable example: DIM SHEETCODE *sheetcode* = Sheets("sheet1").range sheetcode("a1") = sheetcode("b1") + sheetcode("b2") to simplify this... Sheets("sheet1").range("a1") = sheets("sheet1").range("b1")+ _ Sheets("sheet1").range("b2") Or something similar, this is just to give an idea of what I am talking about. Or maybe I can achieve the same results by defining a function? I have to do this to several cells which is why I ask, So I still need to define the range. Im a newb... So any help would be cool Thanks Chris :cool: -- justchris ------------------------------------------------------------------------ justchris's Profile: http://www.excelforum.com/member.php...fo&userid=8894 View this thread: http://www.excelforum.com/showthread...hreadid=345789 |
Can this be done?
Chris,
Not sure exactly what you are are after, but does this help ? Dim MyRange As Range With ThisWorkbook.Sheets(1) Set MyRange = Union(.Range("B1"), .Range("B2")) End With Or do you mean to add the values ? With ThisWorkbook.Sheets(1) .Range("A1").Value = .Range("B1").Value + .Range("B2").Value End With NickHK "justchris" wrote in message ... Hi, I was wondering if i could take a simple bit of code and assign it to a varriable example: DIM SHEETCODE *sheetcode* = Sheets("sheet1").range sheetcode("a1") = sheetcode("b1") + sheetcode("b2") to simplify this... Sheets("sheet1").range("a1") = sheets("sheet1").range("b1")+ _ Sheets("sheet1").range("b2") Or something similar, this is just to give an idea of what I am talking about. Or maybe I can achieve the same results by defining a function? I have to do this to several cells which is why I ask, So I still need to define the range. Im a newb... So any help would be cool Thanks Chris :cool: -- justchris ------------------------------------------------------------------------ justchris's Profile: http://www.excelforum.com/member.php...fo&userid=8894 View this thread: http://www.excelforum.com/showthread...hreadid=345789 |
All times are GMT +1. The time now is 01:37 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com