View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default CurrentRegion.Address

Post you code. It should be easily fixed.

"Thiago Labeg" wrote:

Hello guys, a difficult queston, in my opinion:

I'm using Excel VBA to retrieve informations from an Access Database.
As SQL's results are variable, I need to use a loop to increment data
and generate a list.

ActiveCell.CurrentRegion.Address is the command that returns me something
like "$G$5" (if one cell unmerged is selected) or "$A$2:$B$2" (if it's a
range or more than one single cell).

Basically, after opening and editing document, all these references get lost.
When I select (using still VBA) one range to use function "COUNTIF()", excel
missunderstands these ranges and my sums goes wrong between circular
references and others columns or rows.
For List generation, I'm using a for loop to increment Cells(i,j).Value.

I've created a small macro to indicate me what is the range that I'm working.
Unfortunately, when I select a cell (that is not merged), it returns me
something like "$A$25:$K$31".

What should I do?
I really appreciatte your help.

Thanks,