![]() |
Writing Data with a macro???
I'm trying to create a macro that but it keeps returning to the same cell.
How can I change it to run from whatever cell I'm in? Sub Medford() ' ' Medford Macro ' Macro recorded 1/3/2009 by ted ' ' Keyboard Shortcut: Ctrl+m ' ActiveCell.FormulaR1C1 = "Medford" Range("C4").Select ActiveCell.FormulaR1C1 = "250" Range("B4").Select Selection.EntireRow.Insert End Sub Sub Porland() ' ' Portland Macro ' Macro recorded 1/3/2009 by ted ' ' Keyboard Shortcut: Ctrl+p ' ActiveCell.FormulaR1C1 = "Portland" Range("C4").Select ActiveCell.FormulaR1C1 = "54" Range("B4").Select Selection.EntireRow.Insert End Sub |
Writing Data with a macro???
ActiveCell= "Medford"
Range("C4")= "250" Range("B4").EntireRow.Insert -- Don Guillett Microsoft MVP Excel SalesAid Software "Ted" wrote in message ... I'm trying to create a macro that but it keeps returning to the same cell. How can I change it to run from whatever cell I'm in? Sub Medford() ' ' Medford Macro ' Macro recorded 1/3/2009 by ted ' ' Keyboard Shortcut: Ctrl+m ' ActiveCell.FormulaR1C1 = "Medford" Range("C4").Select ActiveCell.FormulaR1C1 = "250" Range("B4").Select Selection.EntireRow.Insert End Sub Sub Porland() ' ' Portland Macro ' Macro recorded 1/3/2009 by ted ' ' Keyboard Shortcut: Ctrl+p ' ActiveCell.FormulaR1C1 = "Portland" Range("C4").Select ActiveCell.FormulaR1C1 = "54" Range("B4").Select Selection.EntireRow.Insert End Sub |
Writing Data with a macro???
How does that work in any cell??? It has the C4 and B4 Range in the Macro |
Writing Data with a macro???
How about describing what you want to do?
Change the activecell to some text. Move up/down xx rows and right/left yy columns and change that cell. Then move ... C4 and B4 don't add much information to where things should go. With activecell .value = "Medford" .offset(3,5).value = 250 .offset(2,0).entirerow.insert end with But those .offset() numbers aren't right (except by coincidence). They first number is the number of rows (down if positive, up if negative) and the second number is the number of columns (positive=right, negative=left). Maybe you can figure out what you need???? Ted wrote: How does that work in any cell??? It has the C4 and B4 Range in the Macro -- Dave Peterson |
Writing Data with a macro???
I want to jump from cell to cell in the colum and fill the cell with data
for a expense report Medford 250 Portland 150 Ashlans 175 Medford 250 Medford 250 Medford 250 Portland 150 So if I keep hitting clt+m or what ever, it dosn't matter what cell I'm in |
Writing Data with a macro???
ctl+m
Medford 250 ctl+p PortLand 150 ctl+a Ashland 275 So I can go to any cell and use the Macro to fill with data |
Writing Data with a macro???
Sub Medford()
With activecell .value = "Medford" .offset(0,1).value = 250 end with End Sub will plop Medford into the activecell and 250 in the cell to the right. Ted wrote: I want to jump from cell to cell in the colum and fill the cell with data for a expense report Medford 250 Portland 150 Ashlans 175 Medford 250 Medford 250 Medford 250 Portland 150 So if I keep hitting clt+m or what ever, it dosn't matter what cell I'm in -- Dave Peterson |
Writing Data with a macro???
Thanx that got. I just adde in the insert row.
I'll be reading up on how that works. |
All times are GMT +1. The time now is 05:46 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com