LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Populating a range of empty cells with usernames

Hello,

I am trying to make an array of usernames which are located on Sheet2.
And then trying to fill empty cells with those usernames in Sheet3 in
a range of cells: A1 to I9. Below is my code. But seems like I am not
understanding how to use activecell and so Excel doesn't like it
giving an error saying "Object doesn't support this property or
method".

Appreciate for a help in advance!

Thanks,
DD

Private Sub CommandButton1_Click()

Dim oldnames As Range
Dim newnames As Range
Dim x As Integer
Dim n As Integer
Dim i As String
Dim k As Integer

Set newnames = Worksheets("Sheet2").Range("A1:A4")

n = 1

For Each cell In Worksheets("Sheet3").Range("A1:I9")
If IsEmpty(ActiveCell) Then
Worksheets("Sheet3").ActiveCell = newnames(n)
If (n <= 2) Then
n = n + 1
Else
n = 1
End If
End If
Next cell

UserForm1.Hide

End Sub
 
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
Randomly populating empty cells with other text cells Throme88 Excel Discussion (Misc queries) 3 July 1st 08 02:58 PM
Populating empty cells Colin Hayes Excel Worksheet Functions 4 August 4th 06 05:51 PM
populating a cell will a value from a range of cells leo Excel Programming 0 February 4th 06 08:21 PM
populating a cell will a value from a range of cells Gary''s Student Excel Programming 0 February 4th 06 02:35 PM
populating a cell will a value from a range of cells Gary''s Student Excel Programming 0 February 4th 06 12:16 PM


All times are GMT +1. The time now is 05:15 AM.

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"