A macro for a single column until end of data in the column
Closed
ZGL
Posts
1
Registration date
Wednesday June 19, 2013
Status
Member
Last seen
June 19, 2013
-
Jun 19, 2013 at 10:05 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Jun 20, 2013 at 10:41 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Jun 20, 2013 at 10:41 AM
Related:
- A macro for a single column until end of data in the column
- Display two columns in data validation list but return only one - Guide
- Tmobile data check - Guide
- Gta 5 data download for pc - Download - Action and adventure
- Spell number in excel without macro - Guide
- How to delete column in word - Guide
1 response
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
December 27, 2022
555
Jun 20, 2013 at 10:41 AM
Jun 20, 2013 at 10:41 AM
Hi ZGL,
Why don't you just put the formula in the cell and drag it down.
If you don't like the error message when there is no value in column K or W you could add an IF statement like:
=IF(ISERROR(YOUR FORMULA),"",YOUR FORMULA)
Or you can try your adjusted code:
Best regards,
Trowa
Why don't you just put the formula in the cell and drag it down.
If you don't like the error message when there is no value in column K or W you could add an IF statement like:
=IF(ISERROR(YOUR FORMULA),"",YOUR FORMULA)
Or you can try your adjusted code:
Sub ReplacementDate() Dim x, lRow As Integer ' ' ReplacementDate Macro ' Run this macro to calculate the replacement date based on columns K & W ' ' Range("AE1").Select ActiveCell.FormulaR1C1 = "Replacement Date" With ActiveCell.Characters(Start:=1, Length:=16).Font .Name = "SansSerif" .FontStyle = "Bold" .Size = 9 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .Color = -16777216 .TintAndShade = 0 .ThemeFont = xlThemeFontNone End With x = 1 lRow = Range("AE" & Rows.Count).End(xlUp).Row Do x = x + 1 If Range("W" & x) <> vbNullString Then Range("AE" & x).Select ActiveCell.FormulaR1C1 = _ "=(DATE(YEAR(RC[-20])+RC[-8],MONTH(RC[-20]),DAY(RC[-20])))" End If Loop Until x = lRow End Sub
Best regards,
Trowa