looking for out of the box solution

Pilot5000

New member
Joined
Jan 23, 2014
Messages
1
Reaction score
0
Points
0
I have range in excel which I name it “Mike” (A2:A6) , in that range I several lines as follow:
Code:
Sheets("B").Range("a2").SelectRange("H15").Value = Sheets("D").Range("B2").Value
 Range("H16").Value = "3Yr"  Range("H17").Value = Sheets("D").Range("C5").Value
Range("H18").Value = "3 Year Average Efficiency"
Range("H20").Value = "3Yr"
I would like to know if this range & those lines can be executed via VBA, by the name rage mentioned. Moreover, those lines are basically part of macro which I hope I can place then in a sheet and not in a module, I know that in lotus you can write your macro in a range on a sheet name that range , and then activate that macro by calling the name of you have it to be executed , by click button , is that option existed also in VBA and excel (p.s.- I place here the original code in VBA)

Code:
[COLOR=black][FONT=Times New Roman][FONT=Calibri][SIZE=3]
Sub CMC()[/SIZE][/FONT][/FONT][/COLOR]
[COLOR=black][FONT=Times New Roman][FONT=Calibri][SIZE=3]Sheets("B").Range("a2").Select[/SIZE][/FONT][/FONT][/COLOR]
[COLOR=black][FONT=Times New Roman][FONT=Calibri][SIZE=3]Range("a2").Value = Sheets("D").Range("B2").Value[/SIZE][/FONT][/FONT][/COLOR]
[COLOR=black][FONT=Times New Roman][FONT=Calibri][SIZE=3]Range("B2").Value = "3Yr"[/SIZE][/FONT][/FONT][/COLOR]
[COLOR=black][FONT=Times New Roman][FONT=Calibri][SIZE=3]Range("a10").Value = Sheets("D").Range("C5").Value[/SIZE][/FONT][/FONT][/COLOR]
[COLOR=black][FONT=Times New Roman][FONT=Calibri][SIZE=3]Range("C10").Value = "3 Year Average Efficiency"[/SIZE][/FONT][/FONT][/COLOR]
[COLOR=black][FONT=Times New Roman][FONT=Calibri][SIZE=3]Range("f10").Value = "3Yr"[/SIZE][/FONT][/FONT][/COLOR]
[COLOR=black][FONT=Times New Roman][FONT=Calibri]End sub[/FONT][/FONT][/COLOR]


Giving the fact I am newer to VBA my question does not sound too stupid, and any help will be appreciated
 
Back
Top