LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default I must make certain I have a specific range of numbers present.

Florida has 67 counties. When I export data from an Acess database into an
Excel database, depending on the monthly report, not all 67 counties are
present. In order to work with the data in other reports, I need to make sure
that column A (the county name/number) has all 67 numeric values.

I made a "clean-up" macro that cleans up all unnecessary info, formats, and
inserts summation formulae where needed. My problem is I want it to also
enter missing county numbers (i.e. make certain 1 - 67 exist) and 0 in the
associated columns.

I'm including the macro he

Sub ACCESS_IMPORT_CLEAN_UP()
'
' ACCESS_IMPORT_CLEAN_UP Macro
'

' Select top row
Range("B2:M2").Select

' Delete and shift up
Selection.Delete Shift:=xlUp

' Select first unnecessary column
Range("B2:B150").Select

' Delete and shift left
Selection.Delete Shift:=xlToLeft

' Select unnecessary columns: C,E,G,I,K
Range("C:C,E:E,G:G,I:I,K:K").Select

' Activate the range
Range("K1").Activate

' Delete the selection: C,E,G,I,K & shift to left
Selection.Delete Shift:=xlToLeft

' Scroll back to the left
ActiveWindow.ScrollColumn = 1

' Select All of row 1
Rows("1:1").Select

' Center titles horizontally & vertically (format)
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
' End formatting
End With

' Select Columns A thru G
Columns("A:G").Select

' Autofit the width of Columns A thru G
Columns("A:G").EntireColumn.AutoFit

' Select Cells A1 thru A150
Range("A1:A150").Select

' Select (Special) blank cells in first (A) column
Selection.SpecialCells(xlCellTypeBlanks).Select

' Delete sheet rows (all rows that are blank in Column A)
Selection.EntireRow.Delete

' Scroll down to row 70
ActiveWindow.SmallScroll Down:=48

' Select B70 thru G70
Range("B70:G70").Select

' Sum cells 68 thru 1 in each column (B thru G)
Selection.FormulaR1C1 = "=SUM(R[-68]C:R[-1]C)"

' Select Cell A74
Range("A74").Select

' Write CHECKSUM in active cell (A74)
ActiveCell.FormulaR1C1 = "CHECKSUM:"

' Select Cell (G74)
Range("G74").Select

' Sum cells: Row 4 up , columns left 4 to left 1
ActiveCell.FormulaR1C1 = "=SUM(R[-4]C[-5]:R[-4]C[-1])"

' Select Cells A1 thru A69
Range("A1:A69").Select

' Select (Special) blank cells in first (A) column
Selection.SpecialCells(xlCellTypeBlanks).Select

' Delete sheet rows (all rows that are blank in Column A)
Selection.EntireRow.Delete


End Sub


Any help will be appreciated!!

Accountant Mike
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
If any specific #s are present in range, show each in another cell Steve Excel Worksheet Functions 6 June 24th 09 02:57 PM
how to extract a specific range of days (7 or 30) to make a chart accented Excel Worksheet Functions 0 January 9th 06 09:51 PM
How do I add a range of numbers to sum a specific total? SJoshi Excel Worksheet Functions 3 February 15th 05 01:16 PM
find numbers in a range that add to a specific value Brett Excel Discussion (Misc queries) 1 December 20th 04 01:55 PM
How to verify specific Worksheets are present TBA[_2_] Excel Programming 1 December 10th 03 08:18 AM


All times are GMT +1. The time now is 02:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"