Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 1
Default 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
  #3   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 4
Default Writing Data with a macro???


How does that work in any cell??? It has the C4 and B4 Range in the Macro


  #4   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 35,218
Default 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   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 4
Default 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   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 4
Default 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   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 35,218
Default 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   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 4
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Writing a macro RB[_2_] Excel Worksheet Functions 0 January 14th 08 05:40 PM
Writing macro in Excel CCB AA Excel Worksheet Functions 2 January 31st 06 08:48 PM
Writing Excel Macro McHarrisco Excel Worksheet Functions 1 November 30th 05 09:28 PM
Writing a Macro to add decimal CindyW Excel Worksheet Functions 3 September 1st 05 09:39 PM
writing macro CN New Users to Excel 2 August 2nd 05 06:16 PM


All times are GMT +1. The time now is 07:19 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"