database input & macro

  • Thread starter Thread starter Steve Simons
  • Start date Start date
S

Steve Simons

Help!

I have a DBS that I created a macro for. The macro displays a blank data form and after the user inputs, sorts the DBS
on column B, Descending (Column B contains numbers)

The problem lies in that I want a blank column A and blank Row 1, where I can place buttons to run macros. Whenever I
do the sort, of course XL is sorting the blank row 1 to the bottom of the DBS.

Any ideas much appreciated.

TIA

Steve
 
Steve,

It sounds as if you're selecting once cell and letting it expand the range
to determine the range to sort. Or perhaps you're selecting the columns in
their entirety (like A:G), which would include the empty row 1. If you
define a range (Insert - Name - Define) that does not include row 1, it
won't be sorted.

Range("MyTable").Sort ...etc.

Where are the headings? Row 2? If this hasn't helped, say more about the
layout of the sheet.

--
Earl Kiosterud
mvpearl omitthisword at verizon period net
-------------------------------------------

Help!

I have a DBS that I created a macro for. The macro displays a blank data
form and after the user inputs, sorts the DBS
on column B, Descending (Column B contains numbers)

The problem lies in that I want a blank column A and blank Row 1, where I
can place buttons to run macros. Whenever I
 
Hi Earl

I am selecting once cell and letting it expand the range. The headings are in row2 as you guessed.

Will naming the range work, as the range will be one record longer each time there is a new record input via the data
form, will the name range automatically cater for the new record? I'll give it a try.



Steve
 
Hi again

I just tested it and the range doesn't cover the oldest record, so the first record drops out of the named range. I
guess I need some VBA code to expand the range?

Steve
 
Hi Earl

I sorted this out with the following code.

Range("B2", Range("J65536").End(xlUp)).Name = "MyRange"

Many thanks for your help - it got me out of a rut on this!

Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top