Use Dmax In Vba

Aug 16, 2007

I understand that you can use the DMAX function within vba code. I am trying to do this, but don't seem to be able to find an answer. I am formatting data in order for it to be uploaded into a programme called 'Holebase'. The following code loops through each sheet in the workbook, includes the data in a named range, sets up the sheet ready to calculate the DMAX function, and finally adds the dmax function. I am having trouble inserting the DMAX formula.

Sub maxLifData()
' for each worksheet in the workbook, do dmax formulae and add results to new sheet. bhole id on left, depth across top.
Dim ws As Worksheet
Dim wsName() As String
Dim i As Integer
Dim mCount As Integer
Dim nr1 As Range
Dim nr2 As Range
Dim head1 As String
Dim head2 As String
'Dim dMaxf As String
Dim frange As Range
head1 = "STCN_DPTH"
head2 = "STCN_FFD"
Set frange = Range("G3")
'dMaxf = "=DMAX(" & wsName(i) & ",D2," & frange & ":" & frange.Offset(1, 1) & ")"........................

View 2 Replies


ADVERTISEMENT

Using DMAX To Find Most Current Date By Customer#

Jul 9, 2009

I have a spreadsheet of our Customers rankings with a column with the date that they sent their Report Cards in. I need to pull by Cust# the most current date. I tried using DMAX but I can not get the formula to work. The sheet is not sorted and can not be sorted by Cust#.

=DMAX(A$6:D$886,"Report dated",G$6:G7)

range field criteria

Title row starts at 6

A B C DCust #Marketing LocationCustomerReport dated1034ColmarScientific Systems11-Nov-021032ColmarRaymond4-Feb-031029ColmarPhiladelphia Gear6-Feb-031028ColmarPall4-Apr-031016ColmarGreene Tweed 22-Apr-031032ColmarRaymond6-May-031032ColmarRaymond15-Apr-041012ColmarATK Launch Systems, Inc.27-Apr-041032ColmarRaymond22-Oct-04

View 20 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved