Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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


--
justchris
------------------------------------------------------------------------
justchris's Profile: http://www.excelforum.com/member.php...fo&userid=8894
View this thread: http://www.excelforum.com/showthread...hreadid=345789

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default 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


--
justchris
------------------------------------------------------------------------
justchris's Profile:

http://www.excelforum.com/member.php...fo&userid=8894
View this thread: http://www.excelforum.com/showthread...hreadid=345789



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 07:47 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"