Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
jct
 
Posts: n/a
Default Event Macro - propogate formula

I am trying to use an event macro referenced in another thread,

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Cancel = True 'Eliminate Edit status due to doubleclick
Target.Offset(1).EntireRow.Insert
Target.EntireRow.Copy target.Offset(1).EntireRow
Target.Offset(1).EntireRow.SpecialCells(xlConstant s).ClearContents
End Sub

(credit to: http://www.mvps.org/dmcritchie/excel/insrtrow.htm)

but am getting a debug message on the following line:
Target.Offset(1).EntireRow.SpecialCells(xlConstant s).ClearContents

I need clarification. Any help is appreciated.
Thanks,
Janice

  #2   Report Post  
Posted to microsoft.public.excel.misc
JE McGimpsey
 
Posts: n/a
Default Event Macro - propogate formula

If there are no constants, SpecialCells will throw an error. One
modification:

Private Sub Worksheet_BeforeDoubleClick( _
ByVal Target As Range, Cancel As Boolean)
Cancel = True 'Eliminate Edit status due to doubleclick
With Target.EntireRow
.Offset(1, 0).Insert
.Copy .Offset(1, 0).Cells
On Error Resume Next
.Offset(1, 0).SpecialCells(xlConstants).ClearContents
On Error GoTo 0
End With
End Sub




In article ,
jct wrote:

but am getting a debug message on the following line:
Target.Offset(1).EntireRow.SpecialCells(xlConstant s).ClearContents

I need clarification. Any help is appreciated.

  #3   Report Post  
Posted to microsoft.public.excel.misc
David McRitchie
 
Posts: n/a
Default Event Macro - propogate formula

Hi John,
Thanks for the correction, I've updated several event macros
on my insrtrow.htm page.
---
HTH,
David McRitchie, Microsoft MVP - Excel
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm

"JE McGimpsey" wrote...
If there are no constants, SpecialCells will throw an error. One
modification:



  #4   Report Post  
Posted to microsoft.public.excel.misc
jct
 
Posts: n/a
Default Event Macro - propogate formula

Thanks, that worked. I'm feeling around with macros and learning as I go.
Maybe you know if there's a better way to do what I'm trying to accomplish...

I want to insert column A:C of a pivot table on Sheet1 into Sheet2, which
contains additional formulas. I tried just inserting the same pivot table in
Sheet2, but the formulas do not automatically fill in on the adjacent cells
(D:M). Any ideas?

What I'm doing now is updating the pivot table in Sheet1 and using the
double-click event macro to fill in any additional rows. Clumsy, but it works.

Thanks,
Janice

"JE McGimpsey" wrote:

If there are no constants, SpecialCells will throw an error. One
modification:

Private Sub Worksheet_BeforeDoubleClick( _
ByVal Target As Range, Cancel As Boolean)
Cancel = True 'Eliminate Edit status due to doubleclick
With Target.EntireRow
.Offset(1, 0).Insert
.Copy .Offset(1, 0).Cells
On Error Resume Next
.Offset(1, 0).SpecialCells(xlConstants).ClearContents
On Error GoTo 0
End With
End Sub




In article ,
jct wrote:

but am getting a debug message on the following line:
Target.Offset(1).EntireRow.SpecialCells(xlConstant s).ClearContents

I need clarification. Any help is appreciated.


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
moving the formula "average" over one column in a macro drumstu Excel Worksheet Functions 1 August 23rd 05 08:01 PM
Help on Macro or Formula Nigel Excel Discussion (Misc queries) 2 June 13th 05 01:27 PM
Formula checking multiple worksheets sonic-the-mouse Excel Worksheet Functions 2 June 5th 05 07:48 PM
Fill Formula - Macro Cathy U Excel Discussion (Misc queries) 2 February 22nd 05 04:48 PM
Can you enter a formula in a cell to run a macro? Nevaeh Excel Worksheet Functions 2 February 14th 05 11:51 PM


All times are GMT +1. The time now is 01:20 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"