#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 47
Default visual basic

Hi can anyone help,

I want to set up a macro that will give me a list of names on a sheet eg.
Matthew
Mike
David
Etc
But when I ran the macro it remembers the cell I have originally typed into
and I want it to be able run from where i place my mouse eg. It could Start
in cell C1 or D3 etc. Does anyone know the script i would need?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,624
Default visual basic

It would be helpful to post the macro (or a portion of it if it's long)
in your message. Trying to guess what you recorded is difficult...


In article ,
Matthew wrote:

Hi can anyone help,

I want to set up a macro that will give me a list of names on a sheet eg.
Matthew
Mike
David
Etc
But when I ran the macro it remembers the cell I have originally typed into
and I want it to be able run from where i place my mouse eg. It could Start
in cell C1 or D3 etc. Does anyone know the script i would need?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 47
Default visual basic

Here is a sample of the macro


'
ActiveCell.FormulaR1C1 = "Matthew"
Range("R2").Select
ActiveCell.FormulaR1C1 = "Mike"
Range("R3").Select
ActiveCell.FormulaR1C1 = "David"
Range("R4").Select
End Sub

"JE McGimpsey" wrote:

It would be helpful to post the macro (or a portion of it if it's long)
in your message. Trying to guess what you recorded is difficult...


In article ,
Matthew wrote:

Hi can anyone help,

I want to set up a macro that will give me a list of names on a sheet eg.
Matthew
Mike
David
Etc
But when I ran the macro it remembers the cell I have originally typed into
and I want it to be able run from where i place my mouse eg. It could Start
in cell C1 or D3 etc. Does anyone know the script i would need?


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,624
Default visual basic

One way:

ActiveCell.Value = "Matthew"
ActiveCell.Offset(1, 0).Value = "Mike"
ActiveCell.Offset(2, 0).Value = "David"


another:

ActiveCell.Resize(3, 1).Value = _
Application.Transpose(Array("Matthew", "Mike", "David"))


In article ,
Matthew wrote:

Here is a sample of the macro


'
ActiveCell.FormulaR1C1 = "Matthew"
Range("R2").Select
ActiveCell.FormulaR1C1 = "Mike"
Range("R3").Select
ActiveCell.FormulaR1C1 = "David"
Range("R4").Select
End Sub

"JE McGimpsey" wrote:

It would be helpful to post the macro (or a portion of it if it's long)
in your message. Trying to guess what you recorded is difficult...


In article ,
Matthew wrote:

Hi can anyone help,

I want to set up a macro that will give me a list of names on a sheet eg.
Matthew
Mike
David
Etc
But when I ran the macro it remembers the cell I have originally typed
into
and I want it to be able run from where i place my mouse eg. It could
Start
in cell C1 or D3 etc. Does anyone know the script i would need?


  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,316
Default visual basic

Assuming you're going to be launching this from the starting cell, you can
place all the names in an ARRAY and then loop through the array while
incrementing the row offset value by 1 for each name:


Sub FillIn()
************************************************** **********
Dim varArray As Variant
Dim varItems As Variant
Dim l As Long

'Place all the names in an Array
varArray = Array("Frank", "Fran", "Issac", "Izzie")
varItems = varArray
'Loop through the array and increment the row
'offset value by 1 after each name insertion
For Each varItems In varArray
ActiveCell.Offset(l).Value = varItems
l = l + 1
Next

End Sub

--
Kevin Backmann


"JE McGimpsey" wrote:

One way:

ActiveCell.Value = "Matthew"
ActiveCell.Offset(1, 0).Value = "Mike"
ActiveCell.Offset(2, 0).Value = "David"


another:

ActiveCell.Resize(3, 1).Value = _
Application.Transpose(Array("Matthew", "Mike", "David"))


In article ,
Matthew wrote:

Here is a sample of the macro


'
ActiveCell.FormulaR1C1 = "Matthew"
Range("R2").Select
ActiveCell.FormulaR1C1 = "Mike"
Range("R3").Select
ActiveCell.FormulaR1C1 = "David"
Range("R4").Select
End Sub

"JE McGimpsey" wrote:

It would be helpful to post the macro (or a portion of it if it's long)
in your message. Trying to guess what you recorded is difficult...


In article ,
Matthew wrote:

Hi can anyone help,

I want to set up a macro that will give me a list of names on a sheet eg.
Matthew
Mike
David
Etc
But when I ran the macro it remembers the cell I have originally typed
into
and I want it to be able run from where i place my mouse eg. It could
Start
in cell C1 or D3 etc. Does anyone know the script i would need?


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
visual basic jiwolf Excel Worksheet Functions 2 October 8th 05 09:12 PM
Visual Basic and SP2 JessJ Excel Discussion (Misc queries) 2 October 6th 05 12:17 PM
changing the visual basic in office 2003 to visual studio net bigdaddy3 Excel Discussion (Misc queries) 1 September 13th 05 10:57 AM
Visual Basic Micos3 Excel Discussion (Misc queries) 9 June 28th 05 01:41 PM
Visual Basic Help Duncan Smith Excel Discussion (Misc queries) 1 December 3rd 04 09:13 AM


All times are GMT +1. The time now is 08:30 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"