Why would blank a cell.

I am using a line in VBA:

ActiveCell = strVBELN

Why when it hits this line would it empty the cell?  and now strVBELN is = ""
RWayneHAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Martin LissOlder than dirtCommented:
If strVBELN is blank the cell will become blank.
0
Martin LissOlder than dirtCommented:
Depending on your needs you may want to do something like

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

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
RWayneHAuthor Commented:
So how do I make the ActiveCell = strVBELN, without removing it?
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Martin LissOlder than dirtCommented:
I don't understand. When you say "without removing it", what is the "it" you are referring to?
0
RWayneHAuthor Commented:
It skips over your Ln2 were I am trying to make it = strVBELN
0
RWayneHAuthor Commented:
it is the ActiveCell....  it blanks it out after trying to assign what is there to strVBELN
0
Martin LissOlder than dirtCommented:
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
Anthony BerenguelCommented:
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
Martin LissOlder than dirtCommented:
It skips over your Ln2 were I am trying to make it = strVBELN
Well then strVBELN must be blank.
0
RWayneHAuthor Commented:
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
Martin LissOlder than dirtCommented:
Is strVBELN the name of a cell?
0
RWayneHAuthor Commented:
got it.  It was backwards

strVBELN = ActiveCell     worked.
0
RWayneHAuthor Commented:
Just needed to flip-flop the Ln..   Thanks for the help
0
Martin LissOlder than dirtCommented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.