You are not logged in.

Dear visitor, welcome to Palo Community Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

  • "Pommie" is male
  • "Pommie" started this thread

Posts: 411

Date of registration: Feb 21st 2007

Location: Lytham UK

Occupation: OLAP consultant specialising in retail

  • Send private message

1

Thursday, December 20th 2007, 12:03am

Palo Protect and Copy

I'm not really sure where to put this - I posted the first version in the best practices area under "all about VBA "but I think (hope) it may deserve a thread of its own.

This is a new version of the workbook template that protects the data area from accidental corruption.

Thierry has kindly improved my original code (thank you) , and I think we could all use this as the basis for a shared development template to give some extra functionality to the sheets into which we place the results of the Palo Paste Data function.

So far the code:

* Protects the data area only from accidental deletion

* Disables cut, copy, past & paste special and associated shortcut keys to reduce the possibility of users doing things they shouldn't.

* Allows users to copy a value from a single cell to a range of Palo.data cells without destroying the formula.

Enjoy and hopefully improve! :D

(Filed deleted as new version posted further down this thread)
Best wishes

John Hobson
The Planning Factory, Lytham, UK
www.planfact.co.uk

This post has been edited 1 times, last edit by "Pommie" (Dec 22nd 2007, 10:08am)


Posts: 98

Date of registration: Dec 4th 2007

Location: Austria

  • Send private message

2

Thursday, December 20th 2007, 10:34am

RE: Palo Protect and Copy

Hi Pommie,

pls. check:

Open your file
Select D11
Press the copy button
Select D13
Click Escape (!)

I get an errormessage: "Target Range contains no palo.data formulae - pls reselect."

This happens only on the FIRST run of the macro. Maybe there's something wrong with (global) variables.

I do this on your original file.

Something else:
To test I disabled the check for multiple ranges selections. It works perfectly for multiple ranges. When I select a range outside the report nothing happens and I get an error message, perfect! You are looping through the range with "for each CELL in range" - so what is the trouble with selecting multiple ranges??? If I select correct cells and cells with subtotals (that would require splashing) then the input cells receive the value and the others nothing - like it happens if I select a single range - perfect!

arno

  • "Pommie" is male
  • "Pommie" started this thread

Posts: 411

Date of registration: Feb 21st 2007

Location: Lytham UK

Occupation: OLAP consultant specialising in retail

  • Send private message

3

Thursday, December 20th 2007, 10:44am

RE: Palo Protect and Copy

Thanks Arno

I'll take a look when I get a moment - might be while now as I am trying to wrap up for Christmas.

If anyone can suggest the right code change before I get round to it I'll edit and repost it here.
Best wishes

John Hobson
The Planning Factory, Lytham, UK
www.planfact.co.uk

Posts: 98

Date of registration: Dec 4th 2007

Location: Austria

  • Send private message

4

Thursday, December 20th 2007, 11:31am

RE: Palo Protect and Copy

I cannot solve this. The code of Sub GetRange() never reaches "End With" when I do not click "ok".

"Hello World" never shows up when I press escape:

Sub GetRange()
With Application
.DisplayAlerts = False
Set rRange = .InputBox(Prompt:= _
"Please select a single range with your mouse", _
Title:="Please Specify Target Range", Type:=8)
.DisplayAlerts = True
End With
MsgBox ("hello world") '<================================
etc.

EDIT1:
If I add "On error resume next" in GetRange then it works. (But I do not know what else could happen)

EDIT2:
If I first select a target range without pale formulae and press "OK" then I MUST paste the values somewhere as I cannot get out of the loop by pressing esc.

This post has been edited 1 times, last edit by "cavallo" (Dec 20th 2007, 11:51am)


  • "Pommie" is male
  • "Pommie" started this thread

Posts: 411

Date of registration: Feb 21st 2007

Location: Lytham UK

Occupation: OLAP consultant specialising in retail

  • Send private message

5

Friday, December 21st 2007, 9:11am

Ok - with help from Thierry I have improved this again.

New version here - Now reposted

(The "delete" item on the edit menu can't be reliably greyed out using the information on the MSDN site for the code numbers used. If anyone knows how to do this predictably please let me now ad I will add it back again)

Happy Christmas!!
Pommie has attached the following file:
Best wishes

John Hobson
The Planning Factory, Lytham, UK
www.planfact.co.uk

This post has been edited 3 times, last edit by "Pommie" (Dec 22nd 2007, 10:07am)


Posts: 98

Date of registration: Dec 4th 2007

Location: Austria

  • Send private message

6

Wednesday, February 27th 2008, 10:45am

Inputbox not working (Palocopy v1.2b)

Hello Pommie,

I would like to implement the PaloCopy function into an existing workbook. However, the code does not work when I enter a single range with more than one cell as a target (it works with one cell).

The problem is that the inputbox does not supply a range, if I disable On Error resume next I will get error 424 "object required" because rRange remains Nothing in line

Set rRange = .InputBox(Prompt:= _
"Please select a single range with your mouse", _
Title:="Please Specify Target Range", Type:=8)

I created new workbooks and added the palocopy makro to them without problems.

The problema appears only in the sheet that consists of formulae only (it has not been created with Palo paste view), the other sheets work. Could it be that some Palo-events interfere with the inputbox?

When testing, the code works if I replace the inputbox with some named range like
Set rRange = Range("here")
So, I'd guess that the inputbox has a problem.

At some point the Palo addin does not work anymore, eg. the datac-formula is lost when I enter some data that should be written into the cube.

So far, I could not reproduce the problem in another file, however, palo paste view appears to be active all the time, I could not break the link.

I think I will have to recreate the workbook, however, I do not see why the problem with palocopy/inputbox should not happen again.

Regards

arno

Posts: 98

Date of registration: Dec 4th 2007

Location: Austria

  • Send private message

7

Wednesday, February 27th 2008, 11:21am

So far, I found only one workaround - one makro to copy the value, select the target cells with mouse, makro to paste like:

Sub myCopy()
Range("IV1").Value = Selection.Value
End Sub

Sub myPaste()
Dim myR As Range
Set myR = Selection
sSourceValue = Range("IV1").Value
For Each rCell In myR
'.... your paste code here
Next rCell
End Sub

So, I simply avoid an inputbox (that does not work in the makros above, too!).

arno

  • "Pommie" is male
  • "Pommie" started this thread

Posts: 411

Date of registration: Feb 21st 2007

Location: Lytham UK

Occupation: OLAP consultant specialising in retail

  • Send private message

8

Sunday, March 2nd 2008, 6:11pm

Hi Arno

Sorry not to respond - I have been on vacation - I'll take a look as soon as I have surfaced from the mound of emails and post!

Best wishes

John
Best wishes

John Hobson
The Planning Factory, Lytham, UK
www.planfact.co.uk

Rate this thread