![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Mar 2002
Location: The Netherlands
Posts: 5
|
I used this macro (tip 13 from Mr Excel)
Public Sub CopyDown() LastRow = Range("A65536").End(xlUp).Row For i = 1 To LastRow If Range("A" & i).Value = "" Then Range("A" & i - 1 & ":CB" & i - 1).Copy Destination:=Range("A" & i) Next iEnd Sub I've got the message that "End If" was missing and afterwards I got an error message "1004" Please can someone help me the solve this problem. |
|
|
|
|
|
#2 |
|
Board Regular
Join Date: Feb 2002
Location: Huntington Beach, CA USA
Posts: 327
|
Do you have the syntax: "End IF"
"Your Code" End If End Sub As your last line of code above End Sub? James |
|
|
|
|
|
#3 |
|
New Member
Join Date: Mar 2002
Location: The Netherlands
Posts: 5
|
Dear James,
this was the simple part of the problem. I still had the problem with error 1004 |
|
|
|
|
|
#4 |
|
Board Regular
Join Date: Feb 2002
Location: Huntington Beach, CA USA
Posts: 327
|
Can you post "all" of the code and show
us the line thats returning the error meaasge? James |
|
|
|
|
|
#5 |
|
New Member
Join Date: Mar 2002
Location: The Netherlands
Posts: 5
|
Public Sub CopyDown()
LastRow = Range("A65536").End(xlUp).Row For i = 1 To LastRow If Range("A" & i).Value = "" Then Range("A" & i - 1 & ":CB" & i - 1).Copy Destination:=Range("A" & i) End If Next i End Sub The line with causes the problem: "Range("A" & i - 1 & ":CB" & i - 1).Copy Destination:=Range("A" & i)" See mrExcel archives tip 13 [ This Message was edited by: Anjo on 2002-04-27 13:35 ] |
|
|
|
|
|
#6 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
|
Quote:
1) I had data in column A 2) I had a blank cell within that column ?? |
|
|
|
|
|
|
#7 |
|
New Member
Join Date: Mar 2002
Location: The Netherlands
Posts: 5
|
when I change the code
"If Range("A" & i).Value = "" Then" and I put in "0" instead of "" and also put in 0 in de blank cells it works perfect. It seems it doesn't see the blank cells |
|
|
|
|
|
#8 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
|
Quote:
printable/vieable character You can test this by place in a cell =CODE(D14) where D14 houses your data If cells display a number then you have data in those cells. |
|
|
|
|
|
|
#9 |
|
New Member
Join Date: Mar 2002
Location: The Netherlands
Posts: 5
|
Dear James and Ivan,
thank you very much for your support. The problem was that there the first row may not be empty. Thanks from the Netherlands Anjo |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|