Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.newusers
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.newusers
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.newusers
|
|||
|
|||
Writing Data with a macro???
How does that work in any cell??? It has the C4 and B4 Range in the Macro |
#4
Posted to microsoft.public.excel.newusers
|
|||
|
|||
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 |
#5
Posted to microsoft.public.excel.newusers
|
|||
|
|||
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 |
#6
Posted to microsoft.public.excel.newusers
|
|||
|
|||
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 |
#7
Posted to microsoft.public.excel.newusers
|
|||
|
|||
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 |
#8
Posted to microsoft.public.excel.newusers
|
|||
|
|||
Writing Data with a macro???
Thanx that got. I just adde in the insert row.
I'll be reading up on how that works. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Writing a macro | Excel Worksheet Functions | |||
Writing macro in Excel | Excel Worksheet Functions | |||
Writing Excel Macro | Excel Worksheet Functions | |||
Writing a Macro to add decimal | Excel Worksheet Functions | |||
writing macro | New Users to Excel |