Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default .insert difference between 97 and 00

Hello Group,

I'm inserting rows via vba with the line:

RangeRow.EntireRow.Resize(intNumRows).Insert
shift:=xlShiftDown

This method works perfectly with Excel 2000 but generates
an error in 97. Any ideas?

Sean
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default .insert difference between 97 and 00

Sean,

How about trying:
RangeRow.EntireRow.Resize(intNumRows).Insert shift:=xlDown

xlShiftDown isn't a constant in Excel.

Hope it works.

E. Froma
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default .insert difference between 97 and 00

Hi E Foma,

From the intermediate wuindow:

?xlShiftDown
-4121
?xlDown
-4121

---
Regards,
Norman



"E. Froma" wrote in message
...
Sean,

How about trying:
RangeRow.EntireRow.Resize(intNumRows).Insert shift:=xlDown

xlShiftDown isn't a constant in Excel.

Hope it works.

E. Froma



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default .insert difference between 97 and 00

Norman,

You're right. Both are constants in Excel 2000. Maybe not in '97?

E. Froma

"Norman Jones" wrote:

Hi E Foma,

From the intermediate wuindow:

?xlShiftDown
-4121
?xlDown
-4121

---
Regards,
Norman



"E. Froma" wrote in message
...
Sean,

How about trying:
RangeRow.EntireRow.Resize(intNumRows).Insert shift:=xlDown

xlShiftDown isn't a constant in Excel.

Hope it works.

E. Froma




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default .insert difference between 97 and 00

Hi E Froma,

xlShiftDown is valid in xl97.

I do not have a loaded copy of xl97 to hand, but I am sure that a Google
groups search limited to pre-2000 posts would confirm.

---
Regards,
Norman




"E. Froma" wrote in message
...
Norman,

You're right. Both are constants in Excel 2000. Maybe not in '97?

E. Froma

"Norman Jones" wrote:

Hi E Foma,

From the intermediate wuindow:

?xlShiftDown
-4121
?xlDown
-4121

---
Regards,
Norman



"E. Froma" wrote in message
...
Sean,

How about trying:
RangeRow.EntireRow.Resize(intNumRows).Insert shift:=xlDown

xlShiftDown isn't a constant in Excel.

Hope it works.

E. Froma








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default .insert difference between 97 and 00

Hi Sean,

What error are you getting and how have you set RangeRow?

I assume that the your code is a single line which has wrapped in the post.

---
Regards,
Norman



"Sean T." wrote in message
...
Hello Group,

I'm inserting rows via vba with the line:

RangeRow.EntireRow.Resize(intNumRows).Insert
shift:=xlShiftDown

This method works perfectly with Excel 2000 but generates
an error in 97. Any ideas?

Sean



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default .insert difference between 97 and 00

set RangeRow = Range("B9")
intNumRows = 5
RangeRow.EntireRow.Resize(intNumRows).Insert shift:=xlShiftDown


worked fine for me in Excel 97. You must have made some other error or the
sheet is protected.

--
Regards,
Tom Ogilvy

"Sean T." wrote in message
...
Hello Group,

I'm inserting rows via vba with the line:

RangeRow.EntireRow.Resize(intNumRows).Insert
shift:=xlShiftDown

This method works perfectly with Excel 2000 but generates
an error in 97. Any ideas?

Sean



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default .insert difference between 97 and 00

Thanks to all responders,

And, I apologize for getting back so late (Work continues on the weekend).

Tom, I verified that the sheet was not protected and still am unable to run
the code below. There is no problem inserting the rows manually but, without
the error check, the macro comes to a hault at the resize line.

Option Explicit

Sub NewTask()
Dim RangeCounter As Range
Dim RangeRow As Range
Dim strIndex As String
Dim intNumRows As Integer
Application.ScreenUpdating = False
For Each RangeCounter In Range("A:A")
If RangeCounter.Value = "Index" Then
intNumRows = 4 'Temp assignment
strIndex = RangeCounter.Row
Set RangeRow = Range("A" & strIndex)
On Error GoTo ErrBailOut
RangeRow.EntireRow.Resize(intNumRows).Insert shift:=xlShiftDown
Exit For
End If
Next
ErrBailOut:
Set RangeRow = Nothing
Application.ScreenUpdating = True
End Sub

Sean

"Tom Ogilvy" wrote:

set RangeRow = Range("B9")
intNumRows = 5
RangeRow.EntireRow.Resize(intNumRows).Insert shift:=xlShiftDown


worked fine for me in Excel 97. You must have made some other error or the
sheet is protected.

--
Regards,
Tom Ogilvy

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default .insert difference between 97 and 00


O'boy,

After further testing the problem has become more convoluted. I closed and
reopened the file and was able to run the code posted above from the VBAIDE.
When I attempted to run the code via a "Command Button", the problem line
generated an error. Not only that but the line now generated an error back
in the IDE.

I repeated the Close/Open but could not get it to run in the IDE. I
substituted in Tom's code and got it to run once before it too started to
fail with the inclusion of a "Command Button".

Perhaps it would be easier to upgrade the old laptop with a more modern
Excel install.

I do appreciate the assistance,
Sean
  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default .insert difference between 97 and 00

There's a bug in xl97 that can be resolved by changing the .takefocusonclick
property of the commandbutton to false.

Or you can add:

activecell.activate

at the top of the code.

It was fixed in xl2k.

Sean T. wrote:

O'boy,

After further testing the problem has become more convoluted. I closed and
reopened the file and was able to run the code posted above from the VBAIDE.
When I attempted to run the code via a "Command Button", the problem line
generated an error. Not only that but the line now generated an error back
in the IDE.

I repeated the Close/Open but could not get it to run in the IDE. I
substituted in Tom's code and got it to run once before it too started to
fail with the inclusion of a "Command Button".

Perhaps it would be easier to upgrade the old laptop with a more modern
Excel install.

I do appreciate the assistance,
Sean


--

Dave Peterson



  #11   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default .insert difference between 97 and 00

Once again, thanks for all of the replies,

Mr. Peterson did hit upon the cause of my problem and his
recommendation has my worksheet up and running again.
Perhaps I'll keep Excel97 around just a little bit longer.

Sean

-----Original Message-----
There's a bug in xl97 that can be resolved by changing

the .takefocusonclick
property of the commandbutton to false.

Or you can add:

activecell.activate

at the top of the code.

It was fixed in xl2k.
Dave Peterson

.

  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default .insert difference between 97 and 00

Sometimes when you include the name of the procedure or how it's called, you'll
get a correct answer more quickly.

That's the reason I could post the correct response. (You previous message had
that info in it.)


(Glad you got it working.)

wrote:

Once again, thanks for all of the replies,

Mr. Peterson did hit upon the cause of my problem and his
recommendation has my worksheet up and running again.
Perhaps I'll keep Excel97 around just a little bit longer.

Sean

-----Original Message-----
There's a bug in xl97 that can be resolved by changing

the .takefocusonclick
property of the commandbutton to false.

Or you can add:

activecell.activate

at the top of the code.

It was fixed in xl2k.
Dave Peterson

.


--

Dave Peterson

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
How calculate a difference btwn 2 TextBox and insert the result inthe appropriate cell John[_34_] Excel Discussion (Misc queries) 4 November 20th 11 02:54 PM
Cannot insert worksheet in exel - not available in insert menu pedro39 Excel Worksheet Functions 1 July 24th 08 12:09 PM
subtract the time difference from another time difference Dannigirl Excel Discussion (Misc queries) 3 September 30th 07 03:47 PM
Insert Next? Or insert a variable number of records...how? Tom MacKay Excel Discussion (Misc queries) 0 April 20th 06 10:44 PM
charting a difference of 2 columns' w/o adding a difference column Wab Charts and Charting in Excel 4 July 27th 05 02:37 AM


All times are GMT +1. The time now is 09:33 AM.

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"