Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Don't want to insert a partial row

Hi everyone,

I want to insert a partial row at D1:F1 if A1 < D1 or B1 < E1 or C1 < F1.
I have an error 1004 and I don't know what to do with.

Sub Macro1()
Range("a1").Activate
With Range("a1")
Do Until ActiveCell.Value < 0.01
Cell_1:
If ActiveCell.Offset(0, 0) = ActiveCell.Offset(0, 3) Then
GoTo Cell_2
Else
.Range(Cells(0, 4), Cells(0, 7)).Insert Shift:=xlDown
'error 1004
ActiveCell.Offset(1, -6).Select
Cell_2:
If ActiveCell.Offset(0, 1) = ActiveCell.Offset(0, 4) Then
GoTo Cell_3
Else
.Range(Cells(0, 4), Cells(0, 7)).Insert Shift:=xlDown
'error 1004
ActiveCell.Offset(1, -6).Select
Cell_3:
If ActiveCell.Offset(0, 2) = ActiveCell.Offset(0, 5)
Then
ActiveCell.Offset(1, 0).Select
Else
.Range(Cells(0, 4), Cells(0, 7)).Insert
Shift:=xlDown 'error 1004
ActiveCell.Offset(1, -6).Select
End If
End If
End If
Loop
End With
End Sub

Thank you for you help.

Christine


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Don't want to insert a partial row

.Range(Cells(0, 4), Cells(0, 7)).Insert Shift:=xlDown

cells must be at least Cells(1,4), Cells(1,7)

zero isn't an acceptable argument for cells.

--
Regards,
Tom Ogilvy

"Christine" wrote in message
.. .
Hi everyone,

I want to insert a partial row at D1:F1 if A1 < D1 or B1 < E1 or C1 <

F1.
I have an error 1004 and I don't know what to do with.

Sub Macro1()
Range("a1").Activate
With Range("a1")
Do Until ActiveCell.Value < 0.01
Cell_1:
If ActiveCell.Offset(0, 0) = ActiveCell.Offset(0, 3) Then
GoTo Cell_2
Else
.Range(Cells(0, 4), Cells(0, 7)).Insert Shift:=xlDown
'error 1004
ActiveCell.Offset(1, -6).Select
Cell_2:
If ActiveCell.Offset(0, 1) = ActiveCell.Offset(0, 4) Then
GoTo Cell_3
Else
.Range(Cells(0, 4), Cells(0, 7)).Insert Shift:=xlDown
'error 1004
ActiveCell.Offset(1, -6).Select
Cell_3:
If ActiveCell.Offset(0, 2) = ActiveCell.Offset(0, 5)
Then
ActiveCell.Offset(1, 0).Select
Else
.Range(Cells(0, 4), Cells(0, 7)).Insert
Shift:=xlDown 'error 1004
ActiveCell.Offset(1, -6).Select
End If
End If
End If
Loop
End With
End Sub

Thank you for you help.

Christine




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Don't want to insert a partial row

Let me qualify that - cells by itself or cells qualified by a sheet object
can't accept zero as an argument since it references a non-existent range.
The other possibility is that you wanted to use cells as an offset from an
existing range. It can take a zero in that case if the range is not
Range("A1"), but the logical choice in your code for that would be the With
Range("A1"), so still would be a problem in that case.

--
Regards,
Tom Ogilvy

"Tom Ogilvy" wrote in message
...
.Range(Cells(0, 4), Cells(0, 7)).Insert Shift:=xlDown

cells must be at least Cells(1,4), Cells(1,7)

zero isn't an acceptable argument for cells.

--
Regards,
Tom Ogilvy

"Christine" wrote in message
.. .
Hi everyone,

I want to insert a partial row at D1:F1 if A1 < D1 or B1 < E1 or C1 <

F1.
I have an error 1004 and I don't know what to do with.

Sub Macro1()
Range("a1").Activate
With Range("a1")
Do Until ActiveCell.Value < 0.01
Cell_1:
If ActiveCell.Offset(0, 0) = ActiveCell.Offset(0, 3) Then
GoTo Cell_2
Else
.Range(Cells(0, 4), Cells(0, 7)).Insert Shift:=xlDown
'error 1004
ActiveCell.Offset(1, -6).Select
Cell_2:
If ActiveCell.Offset(0, 1) = ActiveCell.Offset(0, 4)

Then
GoTo Cell_3
Else
.Range(Cells(0, 4), Cells(0, 7)).Insert

Shift:=xlDown
'error 1004
ActiveCell.Offset(1, -6).Select
Cell_3:
If ActiveCell.Offset(0, 2) = ActiveCell.Offset(0, 5)
Then
ActiveCell.Offset(1, 0).Select
Else
.Range(Cells(0, 4), Cells(0, 7)).Insert
Shift:=xlDown 'error 1004
ActiveCell.Offset(1, -6).Select
End If
End If
End If
Loop
End With
End Sub

Thank you for you help.

Christine






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Don't want to insert a partial row

Hi,

Thank you very much. It works now.

Your truly.

Christine

"Tom Ogilvy" a écrit dans le message de
...
Let me qualify that - cells by itself or cells qualified by a sheet object
can't accept zero as an argument since it references a non-existent range.
The other possibility is that you wanted to use cells as an offset from an
existing range. It can take a zero in that case if the range is not
Range("A1"), but the logical choice in your code for that would be the

With
Range("A1"), so still would be a problem in that case.

--
Regards,
Tom Ogilvy

"Tom Ogilvy" wrote in message
...
.Range(Cells(0, 4), Cells(0, 7)).Insert Shift:=xlDown

cells must be at least Cells(1,4), Cells(1,7)

zero isn't an acceptable argument for cells.

--
Regards,
Tom Ogilvy

"Christine" wrote in message
.. .
Hi everyone,

I want to insert a partial row at D1:F1 if A1 < D1 or B1 < E1 or C1

<
F1.
I have an error 1004 and I don't know what to do with.

Sub Macro1()
Range("a1").Activate
With Range("a1")
Do Until ActiveCell.Value < 0.01
Cell_1:
If ActiveCell.Offset(0, 0) = ActiveCell.Offset(0, 3) Then
GoTo Cell_2
Else
.Range(Cells(0, 4), Cells(0, 7)).Insert Shift:=xlDown
'error 1004
ActiveCell.Offset(1, -6).Select
Cell_2:
If ActiveCell.Offset(0, 1) = ActiveCell.Offset(0, 4)

Then
GoTo Cell_3
Else
.Range(Cells(0, 4), Cells(0, 7)).Insert

Shift:=xlDown
'error 1004
ActiveCell.Offset(1, -6).Select
Cell_3:
If ActiveCell.Offset(0, 2) = ActiveCell.Offset(0,

5)
Then
ActiveCell.Offset(1, 0).Select
Else
.Range(Cells(0, 4), Cells(0, 7)).Insert
Shift:=xlDown 'error 1004
ActiveCell.Offset(1, -6).Select
End If
End If
End If
Loop
End With
End Sub

Thank you for you help.

Christine








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
One partial table, one master table - update the partial boilermaker Excel Discussion (Misc queries) 3 May 28th 10 08:33 PM
Find partial match from column A,B and fill partial match in C? Tacrier Excel Discussion (Misc queries) 4 October 24th 08 11:24 PM
Partial Trendlines Soozie Excel Discussion (Misc queries) 2 November 28th 07 08:53 PM
Partial correlations Bill TOng Excel Discussion (Misc queries) 1 May 10th 06 10:43 PM
How do I insert a partial filename? Admin Excel Discussion (Misc queries) 1 December 1st 05 01:49 AM


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