Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help with Event macro.....


TIA for any help offered!!

I have written the following event macro to copy the entire row above
when a row is insert into the worksheet and paste the formatting and
formulas in the new row.

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row.HasFormula = False Then
Run ("BacktoNormal")
Target.Row.Offset(-1, 0).EntireRow.Select
Selection.Copy
ActiveRow.Offset(1, 0).EntireRow.Select
Application.EnableEvents = False
PasteSpecial Paste:=xlFormulas, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Application.CutCopyMode = False
PasteSpecial Paste:=xlFormats, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Application.CutCopyMode = False
Run ("SpecialMode")
Application.EnableEvents = True

End Sub

Excel is giving me an "invalid qualifier" error and highlighting "Row"
in the first instance of "Target.Row". I am not sure what i am gettng
this error. "BacktoNormal" and "SpecialMode" are macros that run on
the entire workbook preventing the paste function.

Could someone set me straight?


--
Celt
------------------------------------------------------------------------
Celt's Profile: http://www.excelforum.com/member.php...o&userid=19413
View this thread: http://www.excelforum.com/showthread...hreadid=537849

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Help with Event macro.....

"Row" returns a Long integer indicating the row number of a
range. That is why you are having problems with the code

Target.Row.Offset(-1, 0).EntireRow.Select

Get rid of the Row and you should be alright.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Celt" wrote
in message
...

TIA for any help offered!!

I have written the following event macro to copy the entire row
above
when a row is insert into the worksheet and paste the
formatting and
formulas in the new row.

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row.HasFormula = False Then
Run ("BacktoNormal")
Target.Row.Offset(-1, 0).EntireRow.Select
Selection.Copy
ActiveRow.Offset(1, 0).EntireRow.Select
Application.EnableEvents = False
PasteSpecial Paste:=xlFormulas, Operation:=xlNone, SkipBlanks:=
_
False, Transpose:=False
Application.CutCopyMode = False
PasteSpecial Paste:=xlFormats, Operation:=xlNone, SkipBlanks:=
_
False, Transpose:=False
Application.CutCopyMode = False
Run ("SpecialMode")
Application.EnableEvents = True

End Sub

Excel is giving me an "invalid qualifier" error and
highlighting "Row"
in the first instance of "Target.Row". I am not sure what i am
gettng
this error. "BacktoNormal" and "SpecialMode" are macros that
run on
the entire workbook preventing the paste function.

Could someone set me straight?


--
Celt
------------------------------------------------------------------------
Celt's Profile:
http://www.excelforum.com/member.php...o&userid=19413
View this thread:
http://www.excelforum.com/showthread...hreadid=537849



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help with Event macro.....


Thanks very much for your help Chip!


--
Celt
------------------------------------------------------------------------
Celt's Profile: http://www.excelforum.com/member.php...o&userid=19413
View this thread: http://www.excelforum.com/showthread...hreadid=537849

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
Event Macro help Scott Excel Discussion (Misc queries) 3 March 22nd 10 07:19 PM
Event Macro running another macro inside K1KKKA Excel Discussion (Misc queries) 1 December 20th 06 08:21 PM
Event Macro Amy Excel Programming 2 August 4th 04 04:55 PM
Event macro Amy Excel Programming 0 August 4th 04 04:53 PM
Event macro David McRitchie[_2_] Excel Programming 2 July 16th 03 06:20 PM


All times are GMT +1. The time now is 07:34 PM.

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

About Us

"It's about Microsoft Excel"