Forum Discussion
Populating cells with a Date across 12 TABS
- Jan 18, 2023look at both as decimal (or percentage) are they the same or off by 100? It looks like the rate schedule is a true decimal number (i.e. 0.00088 or 0.088%) while the other number is coming in as % units (i.e. 0.088 which if formatted as % would be 8.8%) so basically you need to convert from % UNIT to decimal value.
=(ROUND(K6,3)= ROUND(100*K$3,3))
or BETTER yet change the formula in K3 to be =100*... so
=100*XLOOKUP(LEFT($I5,3),LEFT('Rate Schedule'!$B5:$B16,3),'Rate Schedule'!C5:C16,"error")
As for the GO list, it is convenient to have the Incomplete list there for conditional formatting rule but otherwise you can easily copy it to its own sheet and make its own rule.
gtg to a mtg right now but I'll try and look at the rest of the questions later.
Macro Help Please
Hello Sir, the following Macro is used on a report that gathers information, sorts the information and arranges the information so I can copy and paste it into another workbook. I have had to expand on the information collected, add a column, for Rate Collection. This column did not exist in the workbook for which it was going into. I just need some help adding it to the process so I can copy and paste it with the other data. The workbook this Macro works on has multiple Tabs so the Macro has to reach into an additional Tab to grab the Rates associated with building and place them accordingly in a ROW along side the other collected information for a building number. This Macro works really well and it is called "Data_Prep". I just need it adjusted to add the Rate for the Electricity & Gas Rates. What I am asking for is to add to the existing macro a process to open the "Property PreBill Detail El Tab and grab the EL Rate from column "S" and then open the "Property PreBill Detail GS Tab and grab the GAS Rates from Column "S" and place the Rates in column "S" per the results of the PreBill EL Read Data and in column "P" per the results of the PreBill GS Read Data so I can copy and paste the data into my workbook. I'm not asking for a rewrite of the macro, just an adjustment to the code for the inclusion of the EL Rate and the GS Rate. I have a separate macro for the Water in case the question was to be asked. If someone feels this code could be more efficient I am open to what ever gets the job done.
Thank you and I hope someone is up to the challenge.
Sub Prep_Data()
'
' Prep_Data Macro
' This Macro preps data to be copied and pasted into the Monthly Utility Reads workbook
'
' Keyboard Shortcut: Ctrl+Shift+P
'
Dim wb As Workbook
Dim ws As Worksheet
Dim m As Long
Dim r As Range
Application.ScreenUpdating = False
Set wb = ActiveWorkbook
Set ws = wb.Worksheets("PreBill GS Read Data")
Do
Set r = ws.Range("D:D").Find(What:="104 CC Street")
If r Is Nothing Then Exit Do
r.EntireRow.Delete
Loop
m = ws.Range("F" & ws.Rows.Count).End(xlUp).Row
ws.Columns("F:F").Insert Shift:=xlShiftToRight
With ws.Columns("F:F")
.NumberFormat = "General"
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
With ws.Range("F2:F" & m)
.Formula = "=LEFT(G2,FIND("" "",G2)-1)"
.Value = .Value
End With
ws.Columns("F:F").Insert Shift:=xlShiftToRight
With ws.Columns("F:F")
.NumberFormat = "General"
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
ws.Range("F2:F" & m).FormulaR1C1 = "=IF(ISNUMBER(--RC[1]),--RC[1],LEFT(RC[1],LEN(RC[1])-1)+CODE(RIGHT(RC[1]))/1000)"
With ws.AutoFilter.Sort
.SortFields.Clear
.SortFields.Add Key:=ws.Range("F1"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortTextAsNumbers
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
ws.Columns("H:J").Delete Shift:=xlShiftToLeft
ws.Columns("F:F").Delete Shift:=xlShiftToLeft
With ws.Range("N2:N" & m)
.Formula = "=IF(E2=""Vacant"",""Vacant"","""")"
.Value = .Value
End With
ws.Range("I:I").Insert
Set ws = Sheets("PreBill EL Read Data")
Do
Set r = ws.Range("D:D").Find(What:="104 CC Street")
If r Is Nothing Then Exit Do
r.EntireRow.Delete
Loop
m = ws.Range("I" & ws.Rows.Count).End(xlUp).Row
ws.Columns("I:I").Insert Shift:=xlShiftToRight
With ws.Columns("I:I")
.NumberFormat = "General"
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
ws.Range("I2:I" & m).FormulaR1C1 = "=VLOOKUP(RC[-5],'PreBill GS Read Data'!R2C4:R500C7,3,FALSE)"
ws.Columns("I:I").Insert Shift:=xlShiftToRight
With ws.Columns("I:I")
.NumberFormat = "General"
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
ws.Range("I2:I" & m).FormulaR1C1 = "=IF(ISNUMBER(--RC[1]),--RC[1],LEFT(RC[1],LEN(RC[1])-1)+CODE(RIGHT(RC[1]))/1000)"
With ws.AutoFilter.Sort
.SortFields.Clear
.SortFields.Add Key:=ws.Range("I1"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortTextAsNumbers
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
ws.Columns("I:I").Delete Shift:=xlShiftToLeft
With ws.Range("Q2:Q" & m)
.Formula = "=IF(E2=""Vacant"",""Vacant"","""")"
.Value = .Value
End With
ws.Range("L:L").Insert
Application.ScreenUpdating = True
End Sub