View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
keri keri is offline
external usenet poster
 
Posts: 74
Default Help with looping macro / goto

Hi to all the excel fairies,

I am using a PDF transformer to get data into excel. Unfortunately the
pdf file has tables that the transformer cannot always read properly,
therefore the data I get in excel has strange formatting errors. I was
hoping to sort all of this by code but it is simply impossible. I have
thought of another way of doing this however I am stuck with the
practicalities. (I need this data to be formatted properly before I can
run a giant macro to sort it and chart from it). I would like a
checkdata macro where the user is pointed to each "table" and asked if
the data formatting is correct. This will then make it obvious to the
user if any changes need making, (columns may need moving up or down a
cell, or data entries may need moving across a column etc) and prompt
him to make the necessary changes before continuing.

When the data is transformed it arrives in excel in the form of mini
"tables" (blocks of data normally 9 or 10 columns wide and between 1
and 30 rows down surrounded by a border). There are 26 of these
tables,on one sheet, from rows 1 down to about 900. In between each
"table" there are normally some rows of text. The top left cell of each
"table" is named car 1 to 26.

I would like to take the user to the first "table" and then ask if the
data is formatted correctly. (I have written this code off the top of
my head so apologies for rubbish code that won't work!)

For i = 1 To 26
activesheet.Range("car" & i).Select
ActiveCell.CurrentRegion.Select
msgbox("Is this data formatted correctly?"), vbyesno)

If the data is formatted correctly I want the user to click yes and
then move on to the next "table" etc etc.

That is the simple part. However if the user clicks No - (because there
are problems with the data that need fixing) I need the user to be able
to stop and fix the data. Then I need them to be able to continue
through the loop of checking the rest of the data.

Obviously if they click "No" to the msgbox I could exit the sub with a
msgbox ("Please fix the data") then ask the user to run the checkdata
macro again after making their changes, however this would mean them
re-checking the data they had already checked so is not a great way to
do it.

If anybody understands what I have just written and has any suggestions
I would be most grateful!

Thanks