+ Reply to Thread
Results 1 to 5 of 5

Code to write target cell values to cells in a specific Worksheet?

  1. #1
    Registered User
    Join Date
    10-19-2011
    Location
    East Coast
    MS-Off Ver
    Office 365
    Posts
    33

    Code to write target cell values to cells in a specific Worksheet?

    Hello - I have code (below) that grabs values present in specific cells in .CSV files in the folder designated in my 'BkLogDir' variable and writes them a designated number of columns over to the right in the Active Worksheet (I believe). However, I need to the code to be adjusted to write the values extracted from those targeted .CSV files to a particular Worksheet of the active Workbook. Being only partially familiar with VBA code in general, I'm not even seeing where my current code knows which Worksheet to write to (unless, as I said earlier, it is just writing to the active Worksheet). How do I adjust the code to write to a particular Worksheet in the active Workbook?

    Thank you!

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,969

    Re: Code to write target cell values to cells in a specific Worksheet?

    Something like this, maybe (Note that Sh. has been added in 4 places, before certain range objects)


    Please Login or Register  to view this content.
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Registered User
    Join Date
    10-19-2011
    Location
    East Coast
    MS-Off Ver
    Office 365
    Posts
    33

    Re: Code to write target cell values to cells in a specific Worksheet?

    Thank you for the above code - very helpful! At first, I thought it had errors, but the more I've tested it, the more I'm convinced that I think I've run into an issue with using Microsoft OneDrive. I've researched it pretty extensively, and it seems to be a problem sometimes referring to OneDrive folders via VBA code that hasn't quite been solved as far as I can see. When I run your code on test files in my 'C:\' drive, your code works just fine - I get '#REF!' errors instead of the values I'm targeting when I run the same code referring tot files on OneDrive.

    I'd love to keep my solution on OneDrive as it is properly backed up by my corporate network, as everything developed on my 'C:\' drive is vulnerable to a computer crash, power surge, etc. I've tried using the Environment variable (Environ("UserProfile")), but it does not solve the problem. Has anyone been able to successfully navigate issues writing VBA code against OneDrive files stored in MS Onedrive?

    Thank you!

  4. #4
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,969

    Re: Code to write target cell values to cells in a specific Worksheet?

    I have no experience using OneDrive other than to share files. You might want to start a new thread - nobody will see your last question as it is.

  5. #5
    Registered User
    Join Date
    10-19-2011
    Location
    East Coast
    MS-Off Ver
    Office 365
    Posts
    33

    Re: Code to write target cell values to cells in a specific Worksheet?

    Yes - was definitely thinking that same thing. Thank you for the response!

+ 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] Open Target Worksheet Based on Cell Values
    By wee_bittie in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-22-2014, 09:04 AM
  2. vba code to write values to excel cells
    By Anthony.h in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-18-2013, 05:09 AM
  3. VBA to target a charachter in a specific location in given cell and write it back out
    By Sparkplug90 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-10-2013, 06:32 PM
  4. [SOLVED] write code to copy a current variables value into next available cell in worksheet
    By damayn83 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-01-2013, 04:32 PM
  5. [SOLVED] Help with modifying code to copy specific cells on target row instead of the whole row
    By Spookman in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-28-2012, 05:22 AM
  6. Code to write in specific cell
    By fatalcore in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 07-09-2011, 03:06 PM
  7. [SOLVED] No refresh in target cell when using worksheet.cells.formula = ...
    By Auke in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-15-2005, 10:15 AM
  8. Combining Cells-write a code to get both values
    By Greg B... in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-27-2005, 12:06 PM

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