variable use in range

C

crapit

the data in it update frequently
Dave Peterson said:
The workbook is refreshed (built from scratch) every day???

If yes, then put the macro in another workbook. And run it from there!
 
D

Dave Peterson

If only the data is updated, then the macro can live within that workbook
forever.

If the workbook is rebuilt from scratch, I see the problem. If it's just the
data that's changing, the macro should be safe in that workbook.
 
D

Dave Peterson

Sorry. You should be going left:

LastCol = ActiveSheet.Cells(1, Columns.Count).End(xlToLeft).Column

I'd use:

With Worksheets("status")
.Cells.font.Name = "Arial"
.Cells.font.Size = 10
.Cells.font.Strikethrough = False
.UsedRange.Columns.AutoFit
End with

If you have a follow up to this thread, post back in this thread.

If you have new questions, start a new thread.
 
C

crapit

Thanks for your patience and your great help for the past query that I
posted!
As for the macro, do I really have to go through the activation of VB Editor
, followed by the importing of the VB file (*.bas) ??? Is the any shortcut
customization to load the macro ?
 
D

Dave Peterson

Start a new workbook.
Import the macro into that workbook.
Save that workbook with a nice name: MyWorkbookThatDoesTheWork.xls

When you need to run the macro, open this workbook.
Activate your "real" workbook (assuming that your code works off the active
workbook)

tools|macro|macros...
select your macro and click run
 
C

crapit

Which mean I have to open a "Dummy" workbook? and then choose the macro from
tat workbook?
 
D

Dave Peterson

Yep.

But I still don't understand why you can't store the macro in the "real"
workbook.

Which mean I have to open a "Dummy" workbook? and then choose the macro from
tat workbook?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top