View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
CLK CLK is offline
external usenet poster
 
Posts: 1
Default Need Help with Programming-Syntax/Compile Errors

I know it's been a couple of days, so I hope you're still
checking. I copied and pasted the formula into a macro
and then changed the column reference to C and changed the
title. It reads as follows:

Sub ledger1()

Dim rng As Range

On Error Resume Next
Set rng = Columns("M").SpecialCells(xlBlanks)
On Error GoTo 0

If Not rng Is Nothing Then
rng.EntireRow.Delete
End If

End Sub



However, I'm still getting error messages in the module
before I can even try to run the program.


-----Original Message-----
Hi CLK,

For your purposes, change:

Set rng = Columns("C").SpecialCells(xlBlanks)


to

Set rng = Columns("M").SpecialCells(xlBlanks)



I used column C in my test and forgot to change it back!

---
Regards,
Norman


"Norman Jones" wrote in

message
...
Hi CLK,

Try:

Sub sTester()

Dim rng As Range

On Error Resume Next
Set rng = Columns("C").SpecialCells(xlBlanks)
On Error GoTo 0

If Not rng Is Nothing Then
rng.EntireRow.Delete
End If

End Sub

---
Regards,
Norman



"clk" wrote in

message
...
Programming in excel is new to me.
I want to delete rows of imported data based on

comparing
the data in column M. Column M is where the batch

numbers
are located. I have made several attempts to write a

code
that will delete rows that do not contain numbers, or

even
just the blank rows.
Please help.
I need to also understand exactly what is wrong, so I
won't make the same mistakes next time.
The following is the latest attempt:

Sub CheckBatch()
.ActiveSheet
If Field13 = (xlCellTypeBlanks) Then

EntireRow.Delete
End Sub
'delete rows without a batch number





.