+ Reply to Thread
Results 1 to 7 of 7

Macro:help

Hybrid View

  1. #1
    Registered User
    Join Date
    11-01-2004
    Posts
    37

    Macro:help

    Hi everybody

    I need a macro to copy cell Ai to Bi and continue copying up to empty Ai.

    regards
    hme

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,633
    Hi

    try
    Sub copy()
    Dim i As Long
    i = 1   ' <- - - - - change the value to actual starting row
    With ActiveSheet
        Do
            .Cells(i, 1).copy Destination:=.Cells(i, 2)
            i = i + 1
        Loop Until .Cells(i, 1) = ""
    End With
    End Sub
    hope this helps
    jindon

  3. #3
    Registered User
    Join Date
    11-01-2004
    Posts
    37
    Hi every body

    I use the code suggested by dear Jindon to copy all Ai to Bi up to empty Ai as follow :

    Sub copy()
    Dim i As Long
    i = 1 ' <- - - - - change the value to actual starting row
    With ActiveSheet
    Do
    .Cells(i, 1).copy Destination:=.Cells(i, 2)
    i = i + 1
    Loop Until .Cells(i, 1) = ""
    End With
    End Sub


    But I need to use a formula assume (Ai /1000 ) and then copy to Bi.
    How can I do this?

    Your help is much appreciated.
    Regards
    HME

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,633
    Hi
    But I need to use a formula assume (Ai /1000 ) and then copy to Bi.
    How can I do this?
    I don't understand this meaning.

    if you want to start from row 1000 up to next empty cell then
    use the code and change start to 1000,

    if you want to start from 1st row up to 1000th row then
    Sub copy()
    Dim i As Long
    i = 1 ' <- - - - - change the value to actual starting row
    With ActiveSheet
    Do
    .Cells(i, 1).copy Destination:=.Cells(i, 2)
    i = i + 1
    Loop While i<=1000
    End With
    End Sub
    rgds,
    jindon

  5. #5
    Registered User
    Join Date
    11-01-2004
    Posts
    37
    Dear Jindon

    Thank you for your help

    I mean form row No.1 up to empty Ai. But befor copying to Bi I have to make some calculations for the number inside the cell Ai (for example: dividing to 1000)and then past it to Bi.

    Regards

    HME

  6. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,633
    Hi,

    I see.......
    It is not actually a copy and paste situation, but calculation then.

    Sub copy()
    Dim i As Long
    i = 1 ' <- - - - - change the value to actual starting row
    With ActiveSheet
    Do
        .Cells(i, 2).Value = .Cells(i, 1) / 1000
        i = i + 1
    Loop While .Cells(i, 1) <> ""
    End With
    End Sub
    is it like this?

    rgds,
    jindon

+ 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