Thread: Macro basics
View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.misc
Dallman Ross Dallman Ross is offline
external usenet poster
 
Posts: 390
Default Macro basics

In , Dave Peterson
spake thusly:

I've used this technique when I import files.

I get the data and put it in row 3. I add headers to row 2.
I add autofilters to that range (A2:X9999). But I put all my
subtotals in row 1. (and set rows to repeat at top to 1:2 and
freeze panes so that rows 1 and 2 are always visible).


I've thought about that, based on something someone else said last
week, but I haven't yet succeeded in weaning myself from where they
are now. I like them there! Oh, well.

As for pivot tables, I haven't learned enough about them to get
that to work for my needs. It's something I want to get to. But
meanwhile, I have what I want; I just want to automate the
refresh.

Speaking of auto-filters, my plan with my macro is to turn them off --
I listed the code where I did that -- then do my various refreshes,
etc., then turn them on. But maybe I should just leave them on but
disable them. Not sure how to do that or if it makes much difference.

My latest question is, how do I do a loop with two sheetnames.
The two a

myCSV = "2006 Realized - CSV Data"
and
myCSV = "Current - CSV Data"


And what I'll do twice is:

With Worksheets(myCSV)
'ActiveSheet.Visible = True
ActiveSheet.Unprotect

Selection.QueryTable.Refresh BackgroundQuery:=False

ActiveSheet.Protect DrawingObjects:=True, _
Contents:=True, Scenarios:=True

'ActiveSheet.Visible = False
End With



Also, when I run that code above, the macro stops and waits
me to hit the Enter key to accept the suggested name for the
query refresh. I don't know why. (And I just got the
circular-reference warning trying my half-complete macro
up to this point. I'll have to try that warning-shut-off
syntax you suggested might help.)

Thanks for letting me pick your brain, Dave!

Dallman Ross