Excel VBA code under MSProject
Is it possible to run the following code snippets from a Microsoft Project
Macr? If it is possible to run the code, how might I convert it or make it run under Project. I am exporting timescaledata and would like to do some formatting of the sheet for the user. Thanks Jeff ================================================== ==Sub SameAsAbove() 'Any blank cell in column A will be changed to be the same as the cell above it Dim LastRow As Long Dim cell As Range Dim DataRng As Range LastRow = Cells(Rows.Count, "b").End(xlUp).Row Set DataRng = Range("b2:b" & LastRow) For Each cell In DataRng If cell = "" Then cell = cell.Offset(-1, 0) End If Next cell End Sub ================================================== = Sub Select_Conditional_Rows_WithLoop() Dim col As Range, cell As Range, rng As Range Set col = Intersect(ActiveSheet.UsedRange, Columns(1)) For Each cell In col If Right(cell.Value, 5) = "Total" Then If Not rng Is Nothing Then Set rng = Union(cell, rng) Else Set rng = cell End If End If Next rng.EntireRow.Select Selection.Font.Bold = True End Sub ================================================= Sub PrepWork() Range("A1:A2").Select Selection.Cut Destination:=Range("B1:B2") Columns("A:A").Select Selection.Delete Shift:=xlToLeft End Sub |
All times are GMT +1. The time now is 12:41 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com