+ Reply to Thread
Results 1 to 10 of 10

help advice needed

Hybrid View

stevencarroll19 help advice needed 10-20-2006, 06:13 AM
Carim Hi, Below macro will do... 10-20-2006, 07:15 AM
stevencarroll19 hi thanks for your help but i... 10-20-2006, 08:56 AM
Carim Hi, Have you checked the... 10-20-2006, 11:18 AM
antoka05 Copying name over numbers 10-20-2006, 01:43 PM
  1. #1
    Registered User
    Join Date
    10-20-2006
    Posts
    12

    help advice needed

    Hi

    I was hoping someone will be able to help me.

    I have a column in a sheet, like the following example

    steven
    1
    1
    1
    1
    1
    Bill
    2
    2
    2
    Chris
    3
    3
    3
    3
    3
    3
    3
    3

    So the persons name can be followed by an unlimited number of rows. I don't know whether it will make a difference but the persons name is in blue. I want to be able to fill the persons name down overwriting the numbers below, until the next persons name is reached.

    I am a complete novice, so any help whether a) it is possible, and b) how to go about it would be very much appreciated.
    Last edited by stevencarroll19; 10-20-2006 at 06:21 AM.

  2. #2
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Hi,

    Below macro will do the job ...

    Alt F11 Insert Module
    Copy the code in module ..

    Sub Names()
    Dim i As Integer
    Dim LastRow As Integer
    LastRow = Cells(Cells.Rows.Count, "A").End(xlUp).Row
    For i = 1 To LastRow
    Range("A" & i).Select
    If Len(ActiveCell.Value) = 1 Then
    ActiveCell.Offset(-1, 0).Copy
    ActiveCell.Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    End If
    Next i
    End Sub


    HTH
    Cheers
    Carim

  3. #3
    Registered User
    Join Date
    10-20-2006
    Posts
    12
    hi thanks for your help but i am getting an error message

    I have done as you said but when i run it it says

    run time error '6'

    overflow

    hope you can help

    thanks

  4. #4
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Hi,


    Have you checked the range ...
    Macro runs on column A, adjust to your needs ...

    Carim

  5. #5
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628

    Copying name over numbers

    You can also do so:

    Dim i As Integer
    Dim LastRow As Integer
    LastRow = Cells(Cells.Rows.Count, "A").End(xlUp).Row

    nameToUse = ""
    myRange = "a1:a" & LastRow
    For Each myCell In Range(myRange)
    If IsNumeric(myCell) Then
    If nameToUse <> "" Then
    'here I put the name on cells
    myCell.Value = nameToUse
    End If
    Else
    'here I store the name
    nameToUse = myCell
    End If

    Next

    Regards,
    Antonio

  6. #6
    Registered User
    Join Date
    10-20-2006
    Posts
    12
    Hi

    Thansk for your replies

    I think my original example wasnt a very good one

    Rather than numeric, the cells under each persons name contain text. The column is indeed A as the first anser guessed

    for example

    Steven
    Not Blocked
    Not Purchased
    Not Purchased
    Mike
    Not Purchased
    Not Purchased
    Not Purchased
    Not Purchased
    Not Purchased
    Chris
    Allowed
    Not Blocked
    Not Blocked

    Sorry if i misled you at all

    Thanks

    Steven

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1