+ Reply to Thread
Results 1 to 4 of 4

Macros Import |

  1. #1
    Registered User
    Join Date
    12-26-2012
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    2

    Post Macros Import |

    I currently have an excel worksheet set to import certain values from a Text file. Below code was written to import certain values from specific ranges in the text file.

    Basically on my excell worksheet the cell D23 imports a range of values from the text file. The range is named WPB = Range("$E$46") - Range("$E$44") - Range("$B$30")


    Now the import works perfectly for Infort and Nabbert text files however Rotton text file has a diffrent configuration and the import does not work.

    For the the import to work on Rotton the range should be WPB = Range("$E$66") - Range("$E$64") - Range("$B$30")

    How can I adjust the code to keep so it works for all 3 text files considedring the range for Rotton is diffrent? Basically I do not want to create anothere excecl worksheet for Rotton only, my goal is to have the same excel worksheet to import the files regardless of their configuration



    Please Login or Register  to view this content.
    Last edited by Richard Buttrey; 08-25-2013 at 12:28 PM.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Macros Import |

    Hi, and welcome to the forum.

    Please take a moment to read the forum rules. Code like this should be enclosed in CODE tags. It helps immensely with readability. I'll change it for you on this occasion but note for the future.

    Why not just put the exception in the Case statement and populate the WPB variable before the Case statements. e.g.

    Please Login or Register  to view this content.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    12-26-2012
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Macros Import |

    Thank you for the quick reply, did that but now the import works perfect for Rotton however when I use Infort or Nabbert the import is not done correctly.
    To give you an example: E46 is 1447, E44 is 0 then B30 is 410, correct import figure should be 1037, however right now shows -410. To mention each file has the name of the text file on range B3, so I was thinking to put in a condition to say if the file is Rotton import this range, however if the file is Infort or Nabbert import this range.

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Macros Import |

    Hi,

    Have you stepped through the macro to see what the WPB variable is when you get to it?

    I see no reason why this doesn't work so would you upload both the workbook containing the macro and the sts_fgv.0.9 file.

+ 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. Macros to pull CSV and import to excel
    By chrisbellman00 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-13-2012, 02:07 PM
  2. Is macros needed for this data import
    By asdvender in forum Excel General
    Replies: 1
    Last Post: 03-13-2009, 11:36 AM
  3. Enable Macros After External Data Import
    By NewExcelUser in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-17-2007, 05:04 AM
  4. [SOLVED] how do I import macros from other users
    By Jim Neal in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-11-2005, 12:06 PM
  5. [SOLVED] using macros to import data
    By rocket0612 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-11-2005, 05:06 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