Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
visual basic | Excel Worksheet Functions | |||
Visual Basic and SP2 | Excel Discussion (Misc queries) | |||
changing the visual basic in office 2003 to visual studio net | Excel Discussion (Misc queries) | |||
Visual Basic | Excel Discussion (Misc queries) | |||
Visual Basic Help | Excel Discussion (Misc queries) |