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: 454
Default Could Someone Explain this Code

Could someone explain the code below? I know it takes the values that
are in Report E6;E9 and E12 and posts them on a sheet called Database,
but where I'm unsure is that it posts these on the row below the last
entries, but I don't know which Column on the Database sheet controls
this. What I wish to do is modify the particular column to action
"Post the entries on the row below the last value entered in Column F
on the Database sheet.

Thanks


Sub Database_Post()
Dim r As Long, c As Long, rng As Range
Dim MyValues(9, 5), MyHeaders(2), MyColumns
Application.ScreenUpdating = False

Set rng = Sheets("Database").Cells(65536, "D").End(xlUp).Offset(1,
0)
MyColumns = Array("A", "C", "H", "K", "M")
For r = 0 To 8
For c = 0 To UBound(MyColumns)
MyValues(r, c) = _
Sheets("Report").Cells(18 + 5 * r, MyColumns(c)).Value
Next c
Next r
With Sheets("Report")
MyHeaders(0) = .Range("E6").Value
MyHeaders(1) = .Range("E9").Value
MyHeaders(2) = .Range("E12").Value
End With
rng.Resize(10, 5).Value = MyValues
On Error Resume Next
rng.Offset(0, -3).Resize(rng.Parent.Cells(65536, "D") _
.End(xlUp).Row - rng.Row + 1, 3) = MyHeaders

Sheets("Database").Select
Columns("A:H").Select
Columns("A:H").EntireColumn.AutoFit

Sort

Range("A1").Select
Sheets("Report").Select
Range("A1").Select

End Sub

 
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
Please explain code Karen McKenzie Excel Programming 3 March 12th 07 12:04 PM
Would someone explain what this code does? John Smith Excel Programming 0 December 6th 06 01:02 AM
Please Explain Two Lines of Code ca1358 Excel Programming 1 January 18th 06 04:47 PM
Can someone explain this code to me dht[_2_] Excel Programming 1 September 13th 04 12:03 PM
Please explain why following code doesn't work.... FMNT80 Excel Programming 2 July 23rd 03 06:07 PM


All times are GMT +1. The time now is 06:18 AM.

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"