Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Cell Manipulation


Created a simple macro that fills in each cell with specific values, i
this case names.

Cell Range - C11:C15
Names - Bob, Jim, Jake, Andrew,Kim

Sub Names()
ActiveCell.FormulaR1C1 = "Bob"
Range("C11").Select
ActiveCell.FormulaR1C1 = "Jim"
Range("C12").Select
ActiveCell.FormulaR1C1 = "Jake"
Range("C13").Select
ActiveCell.FormulaR1C1 = "Andrew"
Range("C14").Select
ActiveCell.FormulaR1C1 = "Kim"
Range("C15").Select
End Sub

Question is, how can i make it fill those cells in that same order, bu
if i start at a different cell. So remain in that Range of C11:C15 bu
loop the names in that range. So instead of starting it at C11 i migh
start at C14 but it would still fill the names in that same order, bu
when it reached the last cell in that range it would restart to th
first cell and continue filling the names

--
Cr4z
-----------------------------------------------------------------------
Cr4z3's Profile: http://www.excelforum.com/member.php...fo&userid=1486
View this thread: http://www.excelforum.com/showthread.php?threadid=26493

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Cell Manipulation


how about something like this? - it assumes starting active cell i
where you want to start

Sub Names()
i = activecell.row
k = activecell.column
ActiveCell.Formula = "Bob"
i = i+1
if i 15 then i = 11
cells(i,j).formula = "Jim"
i = i+1
if i 15 then i = 11
cells(i,j).formula = "Jake"
i = i+1
if i 15 then i = 11
cells(i,j).formula = "Andrew"
i = i+1
if i 15 then i = 11
cells(i,j).formula = "Kim"
End Su

--
duan
-----------------------------------------------------------------------
duane's Profile: http://www.excelforum.com/member.php...fo&userid=1162
View this thread: http://www.excelforum.com/showthread.php?threadid=26493

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 690
Default Cell Manipulation

Would any ideas here help? I don't understand the last part of the
question.

Sub Demo()
Dim Names
Names = Array("Bob", "Jim", "Jake", "Andrew", "Kim")
ActiveCell.Resize(1, UBound(Names) + 1) = Names
ActiveCell.Offset(1, 0).Select
End Sub

--
Dana DeLouis
Win XP & Office 2003


"Cr4z3" wrote in message
...

Created a simple macro that fills in each cell with specific values, in
this case names.

Cell Range - C11:C15
Names - Bob, Jim, Jake, Andrew,Kim

Sub Names()
ActiveCell.FormulaR1C1 = "Bob"
Range("C11").Select
ActiveCell.FormulaR1C1 = "Jim"
Range("C12").Select
ActiveCell.FormulaR1C1 = "Jake"
Range("C13").Select
ActiveCell.FormulaR1C1 = "Andrew"
Range("C14").Select
ActiveCell.FormulaR1C1 = "Kim"
Range("C15").Select
End Sub

Question is, how can i make it fill those cells in that same order, but
if i start at a different cell. So remain in that Range of C11:C15 but
loop the names in that range. So instead of starting it at C11 i might
start at C14 but it would still fill the names in that same order, but
when it reached the last cell in that range it would restart to the
first cell and continue filling the names.


--
Cr4z3
------------------------------------------------------------------------
Cr4z3's Profile:
http://www.excelforum.com/member.php...o&userid=14864
View this thread: http://www.excelforum.com/showthread...hreadid=264933



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 618
Default Cell Manipulation

Hi

just a complete different approach which may be of use is not to use code to
do this at all ...
create a custom list
(tools / options / custom lists - type the names in in the order you
want them to appear separated by a comma (,) or enter and click ADD)
then use the list
click where you want the names to start, type the first name & use the
AutoFill handle to drag the names down as far as you want.

Cheers
JulieD

"Cr4z3" wrote in message
...

Created a simple macro that fills in each cell with specific values, in
this case names.

Cell Range - C11:C15
Names - Bob, Jim, Jake, Andrew,Kim

Sub Names()
ActiveCell.FormulaR1C1 = "Bob"
Range("C11").Select
ActiveCell.FormulaR1C1 = "Jim"
Range("C12").Select
ActiveCell.FormulaR1C1 = "Jake"
Range("C13").Select
ActiveCell.FormulaR1C1 = "Andrew"
Range("C14").Select
ActiveCell.FormulaR1C1 = "Kim"
Range("C15").Select
End Sub

Question is, how can i make it fill those cells in that same order, but
if i start at a different cell. So remain in that Range of C11:C15 but
loop the names in that range. So instead of starting it at C11 i might
start at C14 but it would still fill the names in that same order, but
when it reached the last cell in that range it would restart to the
first cell and continue filling the names.


--
Cr4z3
------------------------------------------------------------------------
Cr4z3's Profile:
http://www.excelforum.com/member.php...o&userid=14864
View this thread: http://www.excelforum.com/showthread...hreadid=264933



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 690
Default Cell Manipulation

Julie. That's an excellent idea. If the op wants to use code, perhaps
something like this. There's no error checking to make sure a cell within
C11:C15 is selected.

Sub Demo()
Dim v As Variant

v = Array("Bob", "Jim", "Jake", "Andrew", "Kim")

Application.AddCustomList v

'// Pick a cell in C11:C15 to start
[C14].Select

Selection = v(0)
Selection.AutoFill Range([C11], Selection), xlFillDefault
Selection.AutoFill Range(Selection, [C15]), xlFillDefault
Application.DeleteCustomList Application.GetCustomListNum(v)
End Sub

--
Dana DeLouis
Win XP & Office 2003


"JulieD" wrote in message
...
Hi

just a complete different approach which may be of use is not to use code
to do this at all ...
create a custom list
(tools / options / custom lists - type the names in in the order you
want them to appear separated by a comma (,) or enter and click ADD)
then use the list
click where you want the names to start, type the first name & use the
AutoFill handle to drag the names down as far as you want.

Cheers
JulieD

"Cr4z3" wrote in message
...

Created a simple macro that fills in each cell with specific values, in
this case names.

Cell Range - C11:C15
Names - Bob, Jim, Jake, Andrew,Kim

Sub Names()
ActiveCell.FormulaR1C1 = "Bob"
Range("C11").Select
ActiveCell.FormulaR1C1 = "Jim"
Range("C12").Select
ActiveCell.FormulaR1C1 = "Jake"
Range("C13").Select
ActiveCell.FormulaR1C1 = "Andrew"
Range("C14").Select
ActiveCell.FormulaR1C1 = "Kim"
Range("C15").Select
End Sub

Question is, how can i make it fill those cells in that same order, but
if i start at a different cell. So remain in that Range of C11:C15 but
loop the names in that range. So instead of starting it at C11 i might
start at C14 but it would still fill the names in that same order, but
when it reached the last cell in that range it would restart to the
first cell and continue filling the names.


--
Cr4z3
------------------------------------------------------------------------
Cr4z3's Profile:
http://www.excelforum.com/member.php...o&userid=14864
View this thread:
http://www.excelforum.com/showthread...hreadid=264933







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 690
Default Cell Manipulation

Oops. It needs an "On Error" in case the selection is at the beginning or
end (C11 or C15)

Sub Demo()
Dim v As Variant
[C11:C15].Clear

v = Array("Bob", "Jim", "Jake", "Andrew", "Kim")

Application.AddCustomList v

'// Pick a cell in C11:C15 to start
[C15].Select

On Error Resume Next
With Selection
.Value = v(0)
.AutoFill Range([C11], .Address)
.AutoFill Range(.Address, [C15])
End With
Application.DeleteCustomList Application.GetCustomListNum(v)
End Sub

--
Dana DeLouis
Win XP & Office 2003


"Dana DeLouis" wrote in message
...
Julie. That's an excellent idea. If the op wants to use code, perhaps
something like this. There's no error checking to make sure a cell within
C11:C15 is selected.

Sub Demo()
Dim v As Variant

v = Array("Bob", "Jim", "Jake", "Andrew", "Kim")

Application.AddCustomList v

'// Pick a cell in C11:C15 to start
[C14].Select

Selection = v(0)
Selection.AutoFill Range([C11], Selection), xlFillDefault
Selection.AutoFill Range(Selection, [C15]), xlFillDefault
Application.DeleteCustomList Application.GetCustomListNum(v)
End Sub

--
Dana DeLouis
Win XP & Office 2003


"JulieD" wrote in message
...
Hi

just a complete different approach which may be of use is not to use code
to do this at all ...
create a custom list
(tools / options / custom lists - type the names in in the order you
want them to appear separated by a comma (,) or enter and click ADD)
then use the list
click where you want the names to start, type the first name & use the
AutoFill handle to drag the names down as far as you want.

Cheers
JulieD

"Cr4z3" wrote in message
...

Created a simple macro that fills in each cell with specific values, in
this case names.

Cell Range - C11:C15
Names - Bob, Jim, Jake, Andrew,Kim

Sub Names()
ActiveCell.FormulaR1C1 = "Bob"
Range("C11").Select
ActiveCell.FormulaR1C1 = "Jim"
Range("C12").Select
ActiveCell.FormulaR1C1 = "Jake"
Range("C13").Select
ActiveCell.FormulaR1C1 = "Andrew"
Range("C14").Select
ActiveCell.FormulaR1C1 = "Kim"
Range("C15").Select
End Sub

Question is, how can i make it fill those cells in that same order, but
if i start at a different cell. So remain in that Range of C11:C15 but
loop the names in that range. So instead of starting it at C11 i might
start at C14 but it would still fill the names in that same order, but
when it reached the last cell in that range it would restart to the
first cell and continue filling the names.


--
Cr4z3
------------------------------------------------------------------------
Cr4z3's Profile:
http://www.excelforum.com/member.php...o&userid=14864
View this thread:
http://www.excelforum.com/showthread...hreadid=264933



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
Cell manipulation with imaging vaughnirv Excel Worksheet Functions 1 November 29th 08 04:24 PM
Cell manipulation with imaging vaughnirv Excel Worksheet Functions 1 November 29th 08 04:18 PM
Need Help with Cell Manipulation gm Excel Discussion (Misc queries) 2 January 21st 06 10:11 AM
Help w/ Cell Manipulation gm Excel Worksheet Functions 0 January 21st 06 02:38 AM
Cell reference manipulation RwenglerMN Excel Discussion (Misc queries) 3 April 1st 05 09:51 PM


All times are GMT +1. The time now is 07:13 PM.

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

About Us

"It's about Microsoft Excel"