Solved

Why would blank a cell.

Posted on 2014-11-18
14
62 Views
Last Modified: 2014-11-18
I am using a line in VBA:

ActiveCell = strVBELN

Why when it hits this line would it empty the cell?  and now strVBELN is = ""
0
Comment
Question by:RWayneH
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 6
14 Comments
 
LVL 47

Expert Comment

by:Martin Liss
ID: 40450734
If strVBELN is blank the cell will become blank.
0
 
LVL 47

Accepted Solution

by:
Martin Liss earned 500 total points
ID: 40450738
Depending on your needs you may want to do something like

If Trim(strBLEVN) <> "" Then
    ActiveCell = strVBELN
End If    

Open in new window

0
 

Author Comment

by:RWayneH
ID: 40450739
So how do I make the ActiveCell = strVBELN, without removing it?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 47

Expert Comment

by:Martin Liss
ID: 40450747
I don't understand. When you say "without removing it", what is the "it" you are referring to?
0
 

Author Comment

by:RWayneH
ID: 40450757
It skips over your Ln2 were I am trying to make it = strVBELN
0
 

Author Comment

by:RWayneH
ID: 40450759
it is the ActiveCell....  it blanks it out after trying to assign what is there to strVBELN
0
 
LVL 47

Expert Comment

by:Martin Liss
ID: 40450760
Maybe you can describe the situation. Does the activecell already have something in it? Do you want to replace what's in it or do you want to append strVBELN to it?
0
 
LVL 10

Expert Comment

by:Anthony Berenguel
ID: 40450763
RWayneH, it sounds like you need to use Martin Liss' suggested code that checks to see if strBLEVN is empty. If it's empty then it won't do anything to the active cell. However, if it's not empty then it will assign its value to the active cell.
0
 
LVL 47

Expert Comment

by:Martin Liss
ID: 40450764
It skips over your Ln2 were I am trying to make it = strVBELN
Well then strVBELN must be blank.
0
 

Author Comment

by:RWayneH
ID: 40450773
Here is what I am doing.  It is not assigning the value that is in A2...   strVBELN    (I see a typo in your reply BL?  )
It is skipping over Ln15

Sub GoThruListOfSalesOrders()
sessChoice = "QEC"  'variables used by TESTSAP function
connChoice = "900"
If TestSAP = False Then Exit Sub

Sheets("ListPg").Select
Range("A2").Select
If ActiveCell = "" Then
    MsgBox ("Either list is done, or list was blank.  List of SalesOrder should beginning in cell A2")
    GoTo 200
End If

Do While Not ActiveCell = ""
    If Trim(strVBELN) <> "" Then
    ActiveCell = strVBELN
    End If
   
    session.findById("wnd[0]/tbar[0]/okcd").Text = "/nVA03" 'enter tcode in shortcut field
    session.findById("wnd[0]").sendVKey 0  'press enter
    session.findById("wnd[0]/usr/ctxtVBAK-VBELN").Text = strVBELN
    session.findById("wnd[0]").sendVKey 0  'press enter
    Call GetDataFromSOLN
Loop
200
End Sub

Open in new window

0
 
LVL 47

Expert Comment

by:Martin Liss
ID: 40450791
Is strVBELN the name of a cell?
0
 

Author Comment

by:RWayneH
ID: 40450798
got it.  It was backwards

strVBELN = ActiveCell     worked.
0
 

Author Closing Comment

by:RWayneH
ID: 40450803
Just needed to flip-flop the Ln..   Thanks for the help
0
 
LVL 47

Expert Comment

by:Martin Liss
ID: 40450807
You're welcome and I'm glad I was able to help.

In my profile you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2014
0

Featured Post

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa‚Ķ

732 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