Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Powershell / Excel  set Data and import to Excel - Could anybody assist to complete?

Posted on 2014-09-11
8
Medium Priority
?
199 Views
Last Modified: 2014-09-15
Dear experts,

below you see the part of my code so set and import different custom attributes to variable company shorts
1. I want to write this informations to 4 columns called "CA4" for Cust4 (Column Q - 17), "CA8" for cust8 (18)
"CA10" for cust10 (19) and "CA14" for cust14 (20)
2. Can i use "Default" for all shortcut not explizit listed?

pls see also comments:

$comp = $actRow.Item(3).Value2
       $cust4, $cust10 , $cust14 = 'N', $comp.SubString(0,3)
   
    switch -wildcard ($comp)
    {
      'LST*'       { cust4 = 'F'; cust8 = 'LST'; cust10 = 'LST' }
      'GRIN*'   {                   cust8 = 'LS'; cust10 = 'LS' }
     default   {   cust4 = 'K'; cust8 = 'Z'; cust10 = 'LSBU' }       ;Can i use "default" for all other not listet?
   

  ; or should every default listet as below?


    }
    if ('CXC', 'DXC', 'EMC', 'KUH', 'DER', 'CVT', 'KCC', 'CCS', 'RTT', 'REQ', 'TZU', 'RZU', 'KPAUS' -notcontains $comp)
    {
      $cust10 = 'LF'
      $cust4 = 'D'
      $cust14 = 'DE'}
       
    }
    $actRow.Item(16).Value2 = $cust4
    $actRow.Item(17).Value2 = $cust10
    $actRow.Item(18).Value2 = $cust14
}

$WorkBook.Save()
$objExcel.Quit()

$comp = $actRow.Item(3).Value2
       $cust4, $cust10 , $cust14 = 'N', $comp.SubString(0,3)
   
    switch -wildcard ($comp)
    {
      'LST*'       { cust4 = 'F'; cust8 = 'LST'; cust10 = 'LST' }
      'GRIN*'   {                   cust8 = 'LS'; cust10 = 'LS' }
     default   {   cust4 = 'K'; cust8 = 'Z'; cust10 = 'LSBU' }       ;Can i use "default" for all other not listet?
   

  ; or should every default listet as below?


    }
    if ('CXC', 'DXC', 'EMC', 'KUH', 'DER', 'CVT', 'KCC', 'CCS', 'RTT', 'REQ', 'TZU', 'RZU', 'KPAUS' -notcontains $comp)
    {
      $cust10 = 'LF'
      $cust4 = 'D'
      $cust14 = 'DE'}
       
    }
    $actRow.Item(16).Value2 = $cust4
    $actRow.Item(17).Value2 = $cust10
    $actRow.Item(18).Value2 = $cust14
}

$WorkBook.Save()
$objExcel.Quit()

Open in new window

0
Comment
Question by:Mandy_
  • 5
6 Comments
 
LVL 46

Accepted Solution

by:
aikimark earned 2000 total points
ID: 40318040
If you know the customer number, you can use an OFFSET property of the range, assuming that you have a range pointing to CA1.
0
 
LVL 2

Author Comment

by:Mandy_
ID: 40319616
I've requested that this question be deleted for the following reason:

I solved that by myself
0
 
LVL 2

Author Comment

by:Mandy_
ID: 40319628
I'm using Excel vlookup function from data sheet with all attributes
0
Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

 
LVL 2

Author Comment

by:Mandy_
ID: 40323551
I've requested that this question be closed as follows:

Accepted answer: 0 points for Mandy_'s comment #a40319628

for the following reason:

I'm using Excel vlookup function from data sheet with all attributes
0
 
LVL 2

Author Comment

by:Mandy_
ID: 40319649
vlookup instead of complicate powershell coding
Mandy-vlookup.xlsx
0
 
LVL 2

Author Closing Comment

by:Mandy_
ID: 40323552
thanks
0

Featured Post

 The Evil-ution of Network Security Threats

What are the hacks that forever changed the security industry? To answer that question, we created an exciting new eBook that takes you on a trip through hacking history. It explores the top hacks from the 80s to 2010s, why they mattered, and how the security industry responded.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
My attempt to use PowerShell and other great resources found online to simplify the deployment of Office 365 ProPlus client components to any workstation that needs it, regardless of existing Office components that may be needing attention.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

877 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question