One of the formulas list whether or not an item is available or not. But when I try create a similar formula to indicate whether the item should be displayed or not I only end up with it being always displayed.
what would be the correct format?
Code:
Option Explicit
Sub Reformat()
Dim wks As Worksheet
Dim iRow As Long
For Each wks In ActiveWorkbook.Worksheets
With wks
'delete extraneous columns
Columns("X:AQ").Select
Selection.Delete Shift:=xlToLeft
Range("A1").Select
With .Sort
.SortFields.Clear
.SortFields.Add Key:=Range("R:R"), _
SortOn:=xlSortOnValues, _
Order:=xlAscending, _
DataOption:=xlSortNormal
'additional sort added for more clarity
.SortFields.Add Key:=Range("A:A"), _
SortOn:=xlSortOnValues, _
Order:=xlAscending, _
DataOption:=xlSortNormal
.SetRange wks.Range("A:V")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.Apply
End With
.Range("C:C,E:E,F:F").Insert Shift:=xlToRight
Columns("G:G").Select
Selection.Insert Shift:=xlToRight
.Range("C1").Value = "sku"
.Range("E1").Value = "qty"
.Range("F1").Value = "is_in_stock"
.Range("G1").Value = "status"
.Range("I1").Value = "name"
.Range("K1").Value = "description"
.Range("M1").Value = "cost"
.Range("N1").Value = "map"
.Range("O1").Value = "msrp"
.Range("Q1").Value = "weight"
iRow = .Cells.Find(What:="*", _
After:=.Range("A1"), _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).Row
.Range("C2:C" & iRow).FormulaR1C1 = "=RC24 & ""-"" & RC1 & ""-"" & RC4"
.Range("F2:F" & iRow).FormulaR1C1 = "=IF(RC5>=1,""1"",""0"")"
.Range("G2:G & iRow).FormulaR1C1 = "=IF(RC6>=1,""Enabled"",""Disabled"")"
.Range("H2:H" & iRow).FormulaR1C1 = "=RC2 & "" "" & RC8"
With wks.UsedRange
.Value = .Value
End With
End With
Next wks
End Sub
what would be the correct format?