+ Reply to Thread
Results 1 to 8 of 8

Please: I am trying to copy (using VB) cell data only and I don't know how to do this

  1. #1
    Registered User
    Join Date
    01-04-2015
    Location
    Toronto, Canada
    MS-Off Ver
    14.4.7 excel for mac
    Posts
    14

    Please: I am trying to copy (using VB) cell data only and I don't know how to do this

    Hi Again everyone;

    May I please ask for some additional help.

    I wish to copy data (not cell formulas) from F115:K115.
    I am "trying" to use the following VB formula;

    Range(Range("("f115"), Range("f115").end(xltoRight)).Copy Range ("J10")

    Actually, the above VB formula copies and puts something into the 7 cells to the right of J10, but it's all gibberish.

    I see that I am copying a mish-mash of cell references and so forth, and not 'just' that data (the values) which are in these cells.

    Would someone please tell me how to copy 'only' the values which are in cells (F115:K115) ...
    Oh yes, the values in these cells (F115: K115) keeps changing (as I want it to do) but the data does remain in these cell locations.

    As always, thank you for your help.
    J.

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Please: I am trying to copy (using VB) cell data only and I don't know how to do this

    MAybe:

    Please Login or Register  to view this content.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Registered User
    Join Date
    01-04-2015
    Location
    Toronto, Canada
    MS-Off Ver
    14.4.7 excel for mac
    Posts
    14

    Re: Please: I am trying to copy (using VB) cell data only and I don't know how to do this

    Hi xladept (forum Guru) and thanks for the posting above - it works 100%.
    The code you provided - Range("f134").Resize(1,7).Value = Range("f115").Resize(1,7).Value works perfectly and does copy data from cells f115 to f134. Past that point, :0( I'm in trouble.

    If you have a moment, may I ask for a little bit of additional help please.
    I am on a steep learning curve, but slowly making progress.

    This is the code I have now: which does not function as I require.
    I require the code to copy values from cells f115:L115 and copy them into cells f134:L134.
    If there is data in cells f134:L134 then add 1 to the line count and put that data into (the next row) cells f135:L135 - and so on.
    Potentially, there could be 500 to 1000 rows(lines) of data, so I need the data to be added to the next row if data exists.
    I don't want the 'new' data to overwrite another row of data, so I was using the add 1 to rowCounter, but I made a mess of this.
    If you would/could help - please - thanks in advance,
    J.
    PS: the data in f124:L124 was a row of blank cells with no data in them. (this didn't work)

    Sub dbtest4()
    Dim rowCounter As Integer
    rowCounter = 1
    'tried changing = 0, but I am confusing myself. (see below please)

    Do Until rowCounter = rowCounter +1

    'I believe that the following if statement is not necessary.
    'I believe that I need to focus on the rowCounter, which I have not correctly understood?

    If Range ("f134 = 0 Then
    Range("f134").Resize(1,7).Value = Range("f115").Resize(1,7).Value
    Else
    Range("f134").Resize(1,7).Value = Range("f124").Resize(1,7).Value
    End if

    Loop
    Exit Do
    End Sub

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Please: I am trying to copy (using VB) cell data only and I don't know how to do this

    Maybe:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    01-04-2015
    Location
    Toronto, Canada
    MS-Off Ver
    14.4.7 excel for mac
    Posts
    14

    Re: Please: I am trying to copy (using VB) cell data only and I don't know how to do this

    XLADEPT (Forum Guru) you are quite exceptional! Thank you once again.

    May I ask another question please.
    I don't want to just copy and paste, I want to understand what I am doing - what the code is doing.

    I've only been 'trying' to write code for a week now, so I have lots to learn. (plus, I'm an old man, which doesn't help - don't get old.)

    Would you be able to suggest a location (a URL) or a link on the Web where I can study this rowCounter function and possibly some of the other functions.
    I have tried to find data - something on this rowCounter function and I really can't find anything; Google/MSN just come up with general references, but nothing specific.
    I am studying/taking/watching these on-line VB training videos and they help.
    Some are ok.
    I can't find a location where the VB function/code is located; is there such a site?

    Ok, well I have taken enough of your time.
    I do a lot of saying "thank you," but hey - that's ok too.

    T.U.
    J.

    Thanks again,
    J.

  6. #6
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Please: I am trying to copy (using VB) cell data only and I don't know how to do this

    Hi J,

    plus, I'm an old man, which doesn't help - don't get old.
    I'm 75???

    There is no rowCounter function, rowCounter is just the name of a variable that we've assigned the value of 134 +whateever.

    We have a Tips & Tutorials Forum at this site and you can get some pretty good books at Amazon. The books I have are by Steven Roman "Writing Excel Macros"

    and by John Walkenbach - "Excel 2003 Power Programming with VBA" - as I remember, I got the Walkenbach for about $20.

    It's never too late to learn as our brain cells continue to grow (with stimulation). - Good Luck!

  7. #7
    Registered User
    Join Date
    01-04-2015
    Location
    Toronto, Canada
    MS-Off Ver
    14.4.7 excel for mac
    Posts
    14

    Re: Please: I am trying to copy (using VB) cell data only and I don't know how to do this

    Again, thank you Xladept my (forum Guru) friend.

    I have never enrolled in a programming course: I am doing my best to learn on my own.
    I'm only 67 - you inspire me to keep learning and to do better.
    You - clearly are a brilliant gentleman: thank you (again) for sharing your knowledge with me. (and others)
    I will endeavour to find and purchase both of the books you have identified.

    I am in your debt and from what I can see, you have assisted many others.

    I wish you peace, great health and the hopes that GOD and/or fate will be kind to you.
    Sharing knowledge is one of (if not the) greatest things we can do for each other.

    :0)

    J.

  8. #8
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Please: I am trying to copy (using VB) cell data only and I don't know how to do this

    Hi J,

    Peace and Health also to you - and, you're welcome!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Macro - If adjacent cell contains any data, then copy data from another cell. Possible?
    By BPSJACK in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-15-2014, 06:07 AM
  2. [SOLVED] Formula Needed to copy data from a cell based on data entered into another cell
    By excelteam777 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-10-2013, 03:16 AM
  3. [SOLVED] Copy data with 4 cell interval and copy range of data like vlookup with structured output
    By Daydreams in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-23-2013, 04:08 AM
  4. [SOLVED] How to copy data in a cell in Sheet1 to a cell in Sheet2 using =COPY( )?
    By Mr D Relf in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 07-17-2013, 10:39 AM
  5. Replies: 3
    Last Post: 07-15-2010, 08:49 AM

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