I may be trying to do the impossible. What I need is to dynamically set the PrintTitleRows for each printed page in Excel. My worksheet is created dynamically and there are multiple (yet similar) sections of different row lengths and I want to show the section name and description titles on the top of the following page if the section overflows to multiple pages. The section names will not always be the same though the column titles will. The section name is on the row above the description titles.
Section name and description titles
Currently, I am calling my PageSettings sub and then executing the ExportAsFixedFormat, so I am guessing this can't be done.
I have spent the last few hours searching the Microsoft site, Stackoverflow.com and the web in general with no questions or hits related to this question.
Thanks in advance for any insight you may have.
The answer in no and is based on my experience. The PrintTitleRows and PrintTitleColumns are a one time setting which I did in my PageSettings sub. Once ExportAsFixedFormat starts running, it never hits the PageSettings sub again.
PrintTitleRows is a one time setting that places the same row (or rows) at the top of every printed page but I needed different rows.
The best I found way to achieve this is to add the necessary rows to the worksheet after each page break to make the report look the way I want when printed. I then hide these header rows from the user and display them when I print.
Related
First of all, sorry for the badly worded question, I'm struggling to describe exactly what I'm looking for in a concise way.
I have a spreadsheet which essentially lists the amount of customer requests per month of a given request type (child description), over a three year period.
Using PivotTables, I've been able to summarise this data and create a line graph to display trends over time; this allows me with the click of a button to display a new graph for any of the child descriptions I want, as seen below:
However, a problem arises with some of the request types - not all request types receive customer requests each month, and thus the data I was given is missing those months. It doesn't say '0', it simply isn't there. As seen in the image below, the line graph is a misrepresentation of reality, as there are no 0's, the graph doesn't tell the true story, and can't be used for decision making:
My question is, is there a way to insert the months without data into my spreadsheet in a way other than manually entering it?
Manual data entry is not an option, as I have hundreds of different requests types, and I aim to set this up so I can update it as new data comes in.
Thanks in advance
Thanks to the link provided by Chris Moore, I worked out how to solve my issue.
On the PivotTable, I needed to right click and select 'Field Settings' and select the box 'Show items with no data':
Then I right clicked the PivotTable again and selected 'PivotTable Options', and formatted it so that 'For empty cells show:' was 0:
I am writing a piece of code to copy data from a web table to an excel sheet. I don't understand why I am getting row count and column count 1. Is there something else that I need to add?
Here is my code:
Dim XL
Set XL=createobject("Excel.Application")
XL.Workbooks.Open "D:\QTP\RailwaysforSurat.xlsx"
Set nsheet = XL.Sheets.Item(1)
row=Browser("title:=.*").Page("title:=.*").WebTable("html tag:=TABLE", "index:=0").GetROProperty("rows")
msgbox row
cols=Browser("title:=.*").Page("title:=.*").WebTable("html tag:=TABLE", "index:=1").GetROProperty("cols")
msgbox cols
This not complete code. I have trouble getting rows and columns count. Please help!
P.S. I am using this website for the testing "http://www.indianrail.gov.in/cgi_bin/inet_trnnum_cgi.cgi"
I noticed that you are using Descriptive Programming techniques to identify the WebTable, but you're using extremely generic descriptions for everything. Perhaps that's just scrubbed for the sake of posting publicly, but the important thing that I notice is that your code to read Rows is trying to find a table with Index of 0 and your code to read Cols is trying to find a table with index of 1...
This means you are accessing two different tables. Are you sure that your descriptions are finding the table that you think you want?
My suggestion is to:
1) bring up the page in your browser so that you can see the table.
2) Bring up QTP and open the GuiSPY
3) Click the pointing hand over a cube button to begin spying
4) Click on something inside the table you are trying to work with.
GuiSPY will snap back and show a hierarchy of objects that it found. Next, you want to positively identify what level in that hierarchy is the table at... I would...
5) starting at the top (Browser), select the top row and click "Highlight in Application" and watch what gets lit up.
6) go down the hierarchy list clicking the next item in the hierarchy and clicking "Highlight in Application" until you see it flash on the exact table you're trying to target.
7) Once you have isolated the table, click the button for "Copy the identification properties to the clipboard" button, then close GuiSPY.
8) Open a notepad, or just use QTP's editor window itself and paste in what GuiSPY copied to clipboard.
Ok, you now have a complete list of everything QTP was able to see about the specific table you want to detect. From here, you want to look through the list of properties and find one (or two) that would positively identify that table every time.. For example, on this very page, the table that holds your question could be identified as:
WebTable("text:=I am writing a piece of code to copy data")... (*note I've shaved it down because it's automatically a Regex string... With some cleanup, it could be:
Browser("StackOverFlow.Com").Page("Question 36663629").WebTable("text:=I am writing a piece of code to copy data"))
Now replace your .WebTable("html tag:=TABLE", "index:=0") with that data you've selected, and try it again. Hopefully you can lock in on the exact table you're expecting and get the info you need.
The indianrail page did not open so cannot see the table you are testing. But QTP provides default methods for rows and columns, try using that and see if it works.
NumRows = Browser("Mercury Tours").Page("Search Results").WebTable("OutboundFlights").RowCount
NumColumns = Browser("Mercury Tours").Page("Search Results").WebTable("OutboundFlights").ColumnCount(1)
ColumnCount takes row number as parameter
Not sure what tables you are looking at, but if it is Services and information then the rows/cols value for those table is 1.The whole web page is consisted of concatenated web tables. So its going to be little tricky to capture that information. Try using a child object method and count the number of links within the web table, its going to look something like this -
Set oWebEdit=Description.Create
oWebLink("micclass").value="Link"
Set olink = Browser("title:=.*").Page("title:=.*").WebTable("").childobjects(oWebLink)
olink.count
msgbox olink.count
'Then initiate a for loop
For i = 0 to olink.count-1
' Get the link name
olink. count(i).GetRoproperty("name")
'Initiate an array and save the link names
If get link name does not work then you can use childitem method.
Also make sure you are using the correct index for the tables or define some other properties as well.
P.S. If you are going to use DP in future and haven't already then read about Childitems/childobjects methods.They come in real handy while using DP.
The question pretty much says it I guess. For detailed information:
I have a range of cells (F3:F2000) in which there can be names filled in. I want to be able to count the amount of times, a name has been mentioned. I am doing this with =COUNTIF(...), which is not the problem and works perfectly fine. But I want to be able to have a cell with a dropdown menu in which you can choose from all names mentioned in F3:F2000. My approach so far is to create a dynamic list, and then use this for the dropdown menu. But obviously it just uses all the entries and therefore I get a bunch of the same names. So how do I remove the duplicates? I assume this has to be done in the dynamic list.
Here is my formula for the dynamic list:
=OFFSET(Logbook!$F$3:$F$2000,0,0,COUNTA(Logbook!$F$3:$F$2000)+1,1)
And for those stuck with german excel like me :(, the german version:
=BEREICH.VERSCHIEBEN(Logbook!$F$3:$F$2000;0;0;ANZAHL2(Logbook!$F$3:$F$2000)+1;1)
Take a look at this posting, I think it answers your question.
http://www.get-digital-help.com/2009/05/25/create-a-drop-down-list-containing-only-unique-distinct-alphabetically-sorted-text-values-using-excel-array-formula
I have two different Excel spreadsheets that contain the pricelists of two different manufacturers. I need Excel to highlight the items in the pricelists that occur in both pricelists (Reason: to be able to quickly find the items that both manufacturers offer and who offers it at the best price. The lists are EXTREMELY long hence doing it manually won't work!).
I have searched for two days online to find a solution to this problem but nothing helped. I found one site that offered a code to create a macro, which I tried, but unfortunately only returned an error.
Can anyone give me a solution like a formula that I can simply copy?
If you put the details in a PivotTable then you could compare prices where both manufacturers supply the same item and otherwise see which does and its price:
I am not a programmer but I have to create an expense form for traveling. It has to be in PDF format (preferably Adobe Acrobat editable). I created the form with Excel and exported it to Adobe but, of course, the formulas do not transfer.
I have 3 pages that are identical for calculating travel expenses with the only difference being there is one extra cell on the first page that calculates totals from each page to a grand total. Sounds easy. All the pages calculate individually with no problem but I cannot reference the totals from the individual pages to the first page where the grand total is.
I am using Adobe LiveCycle because it "simplifies" the programming process for people like me. It has worked great so far but this is the only thing problem I am having and the only thing holding me from using the form.
All three pages are in the same document. When I use FormCalc for the totals within each page, it works great:
topmostSubform.Page1.P1TotalGrand::calculate - (FormCalc, client)
$=P1MileageTotal+P1TransAirTotal+P1CarRenTotal+P1HotelTotal+P1AllowTotal+P1PhoneTotal+P1MIETotal+P1BusMealTotal+P1OtherTotal
If I go to the next page, it looks like this:
topmostSubform.Page2.P1TotalGrand::calculate - (FormCalc, client)
$=P1MileageTotal+P1TransAirTotal+P1CarRenTotal+P1HotelTotal+P1AllowTotal+P1PhoneTotal+P1MIETotal+P1BusMealTotal+P1OtherTotal
I just want to be able to add them together. When I try, it doesn't recognize the 2nd page and I don't know why. The form is pretty basic and I would really appreciate any help. If you need any additional information, I'll be glad to oblige.
I believe you can do it. There should be many ways and I am a newbie too so here are two ways...
If you want grand total of 2 pages - does not matter on which page you want it, the formula should be like
topmostSubform.Page1.P1GREATTotalGrand::calculate - (FormCalc, client)
$=P1TotalGrand+P2TotalGrand
The trick is to select both by press and hold Ctrl Key, then select the field you want to select rather then type in. this should solve the problem.
If you want the total to be at page one.
Make the P2GreatTotalGrand to be a global data and create the same data field on page one and add this new one and one already on page one to get the grand total on page one.