Excel Macro to find last cell in Sheet
Closed
DCecil07
DCecil07
- Posts
- 30
- Registration date
- Monday March 15, 2010
- Status
- Member
- Last seen
- September 15, 2010
DCecil07
- Posts
- 30
- Registration date
- Monday March 15, 2010
- Status
- Member
- Last seen
- September 15, 2010
Related:
- Excel Macro to find last cell in Sheet
- Excel macro to copy data from one sheet to another - Guide
- Excel Macro's copy data from one sheet to another ✓ - Forum - Excel
- Excel Macro - using integers as cell referenc ✓ - Forum - Excel
- Excel macro to copy data from one sheet to another based on date ✓ - Forum - Excel
- Excel macro to move row to another sheet ✓ - Forum - Office Software
4 replies
DCecil07
Aug 27, 2010 at 10:51 AM
- Posts
- 30
- Registration date
- Monday March 15, 2010
- Status
- Member
- Last seen
- September 15, 2010
Aug 27, 2010 at 10:51 AM
I found this code at ozgrid.com, How can I put this code into my code above?
Sub AutoFill()
Dim LastRowInA As Long
Dim r As Range
Set r = Range("d1:e1")
LastRowInA = Range("A65536").End(xlUp).Row
r.AutoFill Destination:=Range("d1:e" & LastRowInA)
End Sub
PLEASE HELP ME! Thanks in advance!!!!!!!!!
Sub AutoFill()
Dim LastRowInA As Long
Dim r As Range
Set r = Range("d1:e1")
LastRowInA = Range("A65536").End(xlUp).Row
r.AutoFill Destination:=Range("d1:e" & LastRowInA)
End Sub
PLEASE HELP ME! Thanks in advance!!!!!!!!!
https://www.ozgrid.com/forum/index.php?thread/90616-center-active-cell-s-contents-across-active-column-and-one-column-over/
Did you see this while you were visiting ozgrid?
Did you see this while you were visiting ozgrid?
DCecil07
Aug 30, 2010 at 05:58 AM
- Posts
- 30
- Registration date
- Monday March 15, 2010
- Status
- Member
- Last seen
- September 15, 2010
Aug 30, 2010 at 05:58 AM
I am very new to VBA. Can someone tell me where I put that code into my code shown above?
DCecil07
Aug 30, 2010 at 07:46 AM
- Posts
- 30
- Registration date
- Monday March 15, 2010
- Status
- Member
- Last seen
- September 15, 2010
Aug 30, 2010 at 07:46 AM
I figured it out, here is my new code....
Option Explicit
Sub PreparePTCI()
Dim wsNew As Worksheet
Dim LastRow As Long
LastRow = Range("C" & Rows.Count).End(xlUp).Row
With Columns("G:I").Select
Selection.Insert Shift:=xlToRight
Selection.ColumnWidth = 31.29
Selection.NumberFormat = "General"
With Selection.Interior
.ColorIndex = 37
.Pattern = xlSolid
End With
Selection.Font.Bold = True
End With
Range("H2:H" & LastRow).FormulaR1C1 = "=RC[-5] & ""-"" & RC[-3] & ""-""& RC[-4]"
Range("G2:G" & LastRow).FormulaR1C1 = "=IF(RC[-1]="""",""Blank"",RC[-1])"
' TECI VLookup
Range("I2:I" & LastRow).FormulaR1C1 = "=VLOOKUP(RC[-1],TECI,MATCH(RC[-2],INDEX(TECI,1,),0),0)"
Set wsNew = Sheets.Add
With wsNew
.Name = "TECI"
.Tab.ColorIndex = 3
End With
End Sub
Option Explicit
Sub PreparePTCI()
Dim wsNew As Worksheet
Dim LastRow As Long
LastRow = Range("C" & Rows.Count).End(xlUp).Row
With Columns("G:I").Select
Selection.Insert Shift:=xlToRight
Selection.ColumnWidth = 31.29
Selection.NumberFormat = "General"
With Selection.Interior
.ColorIndex = 37
.Pattern = xlSolid
End With
Selection.Font.Bold = True
End With
Range("H2:H" & LastRow).FormulaR1C1 = "=RC[-5] & ""-"" & RC[-3] & ""-""& RC[-4]"
Range("G2:G" & LastRow).FormulaR1C1 = "=IF(RC[-1]="""",""Blank"",RC[-1])"
' TECI VLookup
Range("I2:I" & LastRow).FormulaR1C1 = "=VLOOKUP(RC[-1],TECI,MATCH(RC[-2],INDEX(TECI,1,),0),0)"
Set wsNew = Sheets.Add
With wsNew
.Name = "TECI"
.Tab.ColorIndex = 3
End With
End Sub