A couple of examples...
Option Explicit
Sub GenericMacro1()
dim myRng as range
dim myCell as range
dim wks as worksheet
set wks = activesheet
with wks
set myrng = .range("a1",.cells(.rows.count,"A").end(xlup).row)
for each mycell in myrng.cells
if mycell.hasformula = false then
mycell.value = lcase(mycell.value)
end if
next mycell
end with
end sub
or using the current selection
Option Explicit
Sub GenericMacro1()
dim myRng as range
dim myCell as range
set myrng = Selection
for each mycell in myrng.cells
if mycell.hasformula = false then
mycell.value = lcase(mycell.value)
end if
next mycell
end sub
Dave Peterson wrote:
When I have generic macros that I want available whenever I open excel, I'll
write the code to use the activesheet--or even use the current selection.
And those kinds of generic macros would go in my personal.xls/.xla workbook.
If I need something that only runs against certain workbooks (or even certain
types of workbooks), I won't put those macros in my personal.xl* workbook. I'll
create a specific workbook/addin for just those utilities.
Those types of macros may need a second sheet--or look for sheets with specific
names (or range names).
Tigerxxx wrote:
Hi,
How can I reference my code so that it points to "All" workbooks that I
would open in Excel?
"royUK" wrote:
An Excel addin is another way. Whichever way you do this you must make
sure that your code references the correct workbook.
--
royUK
Hope that helps, RoyUK
For tips & examples visit my 'web site' (http://www.excel-it.com/)
------------------------------------------------------------------------
royUK's Profile: http://www.thecodecage.com/forumz/member.php?userid=15
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=95209
--
Dave Peterson
--
Dave Peterson