Apply 7th Row Formula
to apply every 7th row a formula
Sub a()
TC = ActiveSheet.UsedRange.Rows.count
For i = TC To 1 Step -7
If i >= 7 Then
Cells(i, 3).Formula = "=Average(" & Cells(i, 2).Address & ":" & Cells(i - 6, 2).Address & ")"
Else
Cells(i, 3).Formula = "=Average(" & Cells(1, 2).Address & ":" & Cells(i, 2).Address & ")"
End If
LI = i
Next
end sub
Sub a()
TC = ActiveSheet.UsedRange.Rows.count
For i = TC To 1 Step -7
If i >= 7 Then
Cells(i, 3).Formula = "=Average(" & Cells(i, 2).Address & ":" & Cells(i - 6, 2).Address & ")"
Else
Cells(i, 3).Formula = "=Average(" & Cells(1, 2).Address & ":" & Cells(i, 2).Address & ")"
End If
LI = i
Next
end sub
-----------------------------------------------------------------------------------
apply bookmarks to each and every page on pdf based on sources in another excel
Option Explicit
Sub GetRWRReportBookmarks()
Dim Exch As Object
Dim AVDoc As Object
Dim AVPageView As Object
Dim PDDoc As Object
Dim PDPage As Object
Dim PDText As Object
Dim PDBookmark As Object
Dim numPages As Integer
Dim bFile As Boolean
Dim bShow As Boolean
Dim iPageNumber As Integer
Dim i As Long, j As Long
Dim c As Range
Dim bTitle As String
With Application
.ScreenUpdating = False
End With
Set Exch = CreateObject("AcroExch.App")
Set AVDoc = CreateObject("AcroExch.AVDoc")
Set PDDoc = CreateObject("AcroExch.PDDoc")
AVDoc.Open "\\XXXXX\SSSS\ssss\rrrrrrr\ttttt\t\ww.pdf", "\\aa\kk\s\q\qs\t\o.pdf"
Debug.Print bShow
bShow = Exch.Show()
Debug.Print bShow
Set PDDoc = AVDoc.GetPDDoc
numPages = PDDoc.GetNumPages()
Debug.Print numPages
Set AVPageView = AVDoc.GetAVPageView
For Each c In Sheets("Index List").Range("A2:A" & Sheets("Index List").Range("A" & Rows.Count).End(xlUp).Row)
If Not c < numPages Then Exit For
AVDoc.GetAVPageView.GoTo c
Set PDBookmark = CreateObject("AcroExch.PDBookmark", "")
Exch.MenuItemExecute ("NewBookmark")
bTitle = PDBookmark.GetByTitle(PDDoc, "Untitled")
bTitle = PDBookmark.SetTitle(c.Offset(0, 1))
Next c
AVDoc.GetAVPageView.GoTo 0
Exch.MenuItemExecute ("Save")
PDDoc.Close
AVDoc.Close (0)
Exch.Exit
Set Exch = Nothing
Set PDDoc = Nothing
Set AVDoc = Nothing
With Application
.ScreenUpdating = True
End With
MsgBox "The Pdf has been BookMarked", vbInformation
End Sub
Comments
Post a Comment