This is my latest development on the subject.
It prints by horizontal priority. It is the sum up of different works, the code is far from optimized.
Sub GetLastShape_3()
'get the rightmost shape, then print up to that page
'
Dim oShp As Shape
Dim ShLast As Single, XBShape As Single, XTShape As...
Hi macropod,
it is not clear to how Peter's worksheet is organized and why he is relying on this method to determine the pages to be printed.
Your message forced me to re-read Peter's messages, and realize he was willing to check the horizontal position of a shape.
At this point the approach...
I think you could use the following macro, that first identify the "last" shape, then determine on which page that shape lays on.
Sub GetLastShape_2()
Dim oShp As Shape
Dim ShLast As Single
Dim ShName As String
'
For Each oShp In ActiveSheet.Shapes
If oShp.BottomRightCell.Row > ShLast Then...
..and you can even sum several cells, for example this will sum 5 adjacents cells from offset(0,0) of the selected month.
=Sum(Offset(Indirect(B5),0,0,1,5))
Bye.
Anthony047 (GMT+1)
I think you need neither the combobox nor the Udf to perform what you explain.
-you create the list of months and assign to this range a name, ex MList
-assign the names of the monthly data ranges same as the names in Mlist (ex Mlist=Jan, Feb, Mar etc; one range named Jan, one named Feb, etc)...
The top inconsistency is that Offset is NOT in the list of WorksheetFunctions available from Vba (check the help on line).
Try this:
Public Function roff(x As Integer, y As Integer)
roff = Range("January").Range("A1").Offset(x, y).Value
End Function
Bye.
Anthony047 (GMT+1)
I don't want to compete with macropod, but this might be a simplified version of the macro:
Sub GetLastShape_2()
Dim oShp As Shape
Dim ShLast As Single
Dim ShName As String
'
For Each oShp In ActiveSheet.Shapes
If oShp.BottomRightCell.Row > ShLast Then
ShLast = oShp.BottomRightCell.Row...
For a moment I was doubtfull about "negative coordinates" (eg Horizontal- 92.5) then I realized it was part of the label! :-)))
It works perfectly, I think we may consider resolved the case(s).
Thanks again, a very useful forum!
Anthony047 (GMT+1)
Hi basbrian,
I suggest the following approach.
-On Sheet2, A2 and B2, set the formulas to copy the data from the corresponding cell of Sheet1; probably they will be =Sheet1!A2 and =Sheet1!B2 (if you now copy col A and B)
-on C2 set your formula
-assign to the range A2:C2 the name "BFormula" (via...
You give me too much, but every byte or kbyte is welcome!
Btw, and no longer related to the problem that your code brilliantly resolved, how can I get the X-Y coordinates of a selection, given that "GetPoint" returns useless information?
(as per my first post, ActiveWindow.GetPoint pLeft...
The right separator for my word version is ";" as both "," and "." results in "Error".
Macropod's macro is very useful, I shall create a modified version to be used on existing documents to reformat the existing text alternatives (like "I agree / I don't agree"); I think I shall set markers...
YES, it DID help, even though I had to add a "space" before the ";" (otherwise the selected text doesn't show as the denominator of the fraction).
I assume using the semicolumn is related to the Italian version of Word.
Thanks to both of you.
Two side questions:
-when I enter manually a fraction, "space" is not allowed in the terms, so I can type "MyWord" but not "My Word"! no any bypass?
-how can I edit the fraction? I can only select it as a whole.
Thank you.
Thank you macropod for your message, it showed me a useful path.
However at the completion of the macro the result is the word "Error" in my document, at the position of the Equation; no any ru-time error. But I was able to enter manually a fraction (Menu /Insert /Field, equation, then used the...
Hello to everybody,
I need to draw a "line" over some text of a Word document; unfortunately using the "strike" effect of the text font is not feasible due to the presence of "subscript" characters.
After selecting the text, I tryed reading the coordinates of the text with...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.