View Single Post
  #11   Report Post  
Posted to microsoft.public.excel.programming
Zack Barresse[_3_] Zack Barresse[_3_] is offline
external usenet poster
 
Posts: 101
Default Clear contents macro

Dave,

Importing to Access is it's own animal, and Access can be quite cumbersome
if everything is not aligned up just right with values and data types, etc.
Are the blank rows there upon Import to Access or is Access adding these
blank rows on it's own somehow? I'm a little confused as to your order of
actions here. Can you post exactly what it is you are doing in specific
order?

--
Regards,
Zack Barresse, aka firefytr
To email, remove NOSPAM


"Dave" wrote in message
...
Hi Luke & Zack
Thanks for your input but i'm confused now, Loop or Autofilter?
All I want to know is, 1.Why when the Spreadsheet data is imported into
Access
it creates blank rows in a table if its less then 175 rows. 2. How can I
get round
this problem.
Thanks
Dave


"Luke Alcatel" wrote:

Fair enough. I did it with loops because 1) I'm a programmer rather than
an
Excel expert and I've never heard of AutoFilter. I do a little VBA
programming when I have to, 2) After reading your mail I looked at
AutoFilter in VBA help. I have a feeling that at his knowledge level
David
would be much better off studying and understanding my loop as opposed to
getting into the esoterica of filter object manipulation.

Luke

"Zack Barresse" wrote in message
...
The reason I ask exactly what you're doing is that if you are looking
for
blank rows, you don't need a loop, we can use AutoFilter, which is (in

most
cases) faster than looping. If we can avoid loops, it's generally
best.

--
Regards,
Zack Barresse, aka firefytr
To email, remove NOSPAM


"Luke Alcatel" wrote in message
...
I don't understand how an operation you perform on the worksheet after

you
import data can affect the imported data but that might be my
problem.

Seems to me that you don't want to hard code row 175 as an upper
bound

but
instead preface your code with a little loop that searches for the
first
fully blank row that follows your poplulated rows. Does that sound
OK

or
do
you still need to know how to write such a loop?

Luke

"Dave" wrote in message
...
Hi
I have a macro that clears the contents of a sheet after I have
imported the data into a database.
This works fine but if the data is less then 175 rows it leaves
blank rows in the database.
How can I get round this.
Not very good with VBA would appreciate any help
Macro as below:-

Range("A2:N175").select
Selection.ClearContents
Range("A2").Select
Workbooks("MyBook1.xls").Close SaveChange:=True