#1
|
|||
|
|||
Daily Spreadsheet Macro
Hi guys,
I have a spreadsheet that I populate every day. I recorded a macro to help me out with some repetitive routines. The macro works, but it is also doing a few things I want to avoid. In column C, all numbers not in bold should have a minus (-). When the cell is blank, the macro place an "0". I want to leave it empty. The next day when I populate the sheet again, the macro should work only in those cells I populate for that day. The same happens in column D, I populate with a number, and I want the macro to add "MIT/" in front of the number. The cells with no number leave it blank. The next day, the macro should work only in those cells I populate for that day and not add another MIT/MIT/9874 My macro code is the following: Macro for Column C ' Amount2 Macro ' ' Range("C6").Select ActiveCell.FormulaR1C1 = "-1" Range("C6").Select Selection.Copy Range("C8,C10,C12,C14,C16,C18,C20,C22,C24,C26,C28, C30,C32,C34,C36,C38,C40,C42,C44,C46,C48,C50,C52,C5 4,C56,C58,C60,C62,C64,C66,C68,C70,C72,C74,C76,C78, C80,C82,C84,C86,C88,C90,C92,C94,C96,C98,C100").Sel ect Range("C100").Activate Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlMultiply, _ SkipBlanks:=False, Transpose:=False Range("C6").Select Application.CutCopyMode = False Selection.ClearContents Macro for Column D: Sub AddMit() ' ' Add MIT/ to the Colunm D ' ' Range("P8").Select Application.CutCopyMode = False ActiveCell.FormulaR1C1 = "=""MIT/""&RC[-12]" Range("P8").Select Selection.AutoFill Destination:=Range("P8:P100"), Type:=xlFillDefault Range("P8:P100").Select ActiveWindow.SmallScroll Down:=-70 Selection.Copy Range("D8").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Range("P8:P100").Select Application.CutCopyMode = False Selection.ClearContents End Sub Thanking you, guys, for any help. Screenshot - Imgur: The magic of the Internet |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Macro to access info from Excel spreadsheet and populate Word doc with text, photos, and captions | henhelm | Word VBA | 4 | 06-27-2019 08:49 PM |
Mac 2011 - When I close a spreadsheet, there is a blank spreadsheet left on dock. | wvinyard | Excel | 0 | 07-27-2017 11:32 AM |
Macro to copy specific columns in Excel from another spreadsheet | KD999 | Excel Programming | 1 | 07-20-2012 08:58 AM |
Macro: Exporting Data to a LEGIBLE Excel Spreadsheet | jeffcoleky | Word VBA | 6 | 05-08-2012 08:24 AM |
Macro will not carry forward to next spreadsheet… | BudParker | Excel Programming | 1 | 01-07-2012 03:44 PM |