I'm trying write a MACRO to do the following (As a small portion of a large MACRO project):
(Consider that I will have a varying number of COLUMNS and ROWS each time the report is generated, so, the columns needed manipulated will be different each time. This is why I need to use Header names.)
Recorded MACRO looks like this (need to replace "RANGE("K2")" with unknown EMPTY cell location. Need to replace "Range("G2:G4786")" with Column Header NAME):
Sub CopySpacePasteAdd()
Range("K2").Select
Selection.Copy
Range("G2").Select
A
Range("G2:G4786").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlAdd, SkipBlanks:= _
False, Transpose:=False
Application.CutCopyMode = False
Thank you SO much for any assistance!
Edit; This code is not that pretty, but it will convert text into numbers for the range below the specific headers.
Dim lRow As Long
lRow = Sheet1.Cells(Rows.Count, 1).End(xlUp).Row
For i = 1 To Columns.Count
If Cells(1, i) = "PROC#/REV CODE" Then
With Cells(1, i).Offset(1).Resize(lRow)
.NumberFormat = "General"
.Value = .Value
End With
ElseIf Cells(1, i) = "FEE RATE" Then
With Cells(1, i).Offset(1).Resize(lRow)
.NumberFormat = "General"
.Value = .Value
End With
Exit For
End If
Next