Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Easy Excel VB question (I think!)

Hi, I was wondering if someone could just help me out with (what I
think is) an easy query on VB syntax in Excel.

I have the following statement...

Sheets("rm tab4").Select
ActiveSheet.PivotTables("PivotTable1").PivotSelect "",
xlDataAndLabel, True
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
End With

This works just fine, except it needs to visit the 'rm tab4' page in
order to execute. This is a pain because when I run the macro from a
page other than 'rm tab4' (which I need to be able to do), it
transports me to rm tab4 and then leaves me there.

To run this without having to visit the page I think I need to lose the
..Select statement. My attempt at this has been...

Sheets("rm tab4").PivotTables("PivotTable1").PivotSelect "",
xlDataAndLabel, True
Sheets("rm
tab4").PivotTables("PivotTable1").Borders(xlInside Horizontal).LineStyle
= xlContinuous

....but Excel just laughs at me. Can anyone help me please?

Cheers.

Kevin

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default Easy Excel VB question (I think!)

Someone familiar with pivot tables can likely help with the syntax.
But a fairly simple solution is to
1) Check from which sheet you run this - dimension a worksheet variable
(StartSheet) and assign it the Activesheet
2) Run this - just what you do now
3) Re-activate the start sheet - StartSheet.activate

HTH,
John

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Easy Excel VB question (I think!)

HI, thanks John. Unfortionately I call the macro from a number of
different places and so cant just specify one single place to return
to. Nice shortcut though!!

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Easy Excel Question Dolphy Excel Discussion (Misc queries) 11 June 5th 07 11:24 AM
Easy Excel formula question bearsfan Excel Discussion (Misc queries) 6 December 24th 06 04:50 PM
excel easy question !!!! Marcello_Geo Setting up and Configuration of Excel 1 August 23rd 05 11:48 AM
new user with easy question? not easy for me speakeztruth New Users to Excel 5 June 3rd 05 09:40 PM
easy question on excel/outlook mike0021[_5_] Excel Programming 1 June 17th 04 10:39 PM


All times are GMT +1. The time now is 11:54 PM.

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

About Us

"It's about Microsoft Excel"