Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA for Excel 1

Status
Not open for further replies.

Hayton

Technical User
Oct 17, 2001
257
NZ
Hi Guys,

I am trying to work the following out with vba and I am not succeeding.

Lets say I have two colums, Col A and Col B in an Excel worksheet and the first 12 rows of col A contain data. The VBA I am trying to do is as follows:

For cell B1 return the following, if A1 contains the word del the leave B1 blank otherwise return the text in A1. Move to B2 and do the same. This needs to be done for all 12 rows (B12).

Any suggestions will be appreciated.

Regards


Hayton McGregor

 
What have you tried so far and where in your code are you stuck ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I am not a code type guy and battle with it. I normally record a macro and and hack that to try and get it to work. However I can't record a macro to do this.

Hayton McGregor

 
A starting point:
With ActiveSheet
For iRow = 1 To 12
If .Cells(iRow, 1) = "del" Then
.Cells(iRow, 2) = ""
Else
.Cells(iRow, 2) = .Cells(iRow, 1)
End If
Next
End With

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks very much. I'll give it a whirl


Hayton McGregor

 




Hayton,

I notice that since October, 2001, you have posted 126 different threads and yet not one Thank You Votes Given, for ANY valuable post.

Certainly PHV's post seemd to be extremely helpful, since, as you previously stated, "I am not a code type guy and battle with it. I normally record a macro and and hack that to try and get it to work. However I can't record a macro to do this."

The resulting Pulple STARS, not only act as a tangible Thank Yous, but also act as indicators for other Tek-Tip members, that posts are helpful. Certainly, when browsing, those are the threads I tend to troll, for good information.

And finally, it is an indication that YOU are appreciative of other members' contributions on your behalf. Not to do so on appropriate occasions, would seem to lead one to believe you have little interest or inclination for offering expressions of gratitude.

Skip,
[sub]
[glasses]Did you hear what happened when the OO programmer lost his library?...
He's now living in OBJECT poverty![tongue][/sub]
 
Hi Skip,
I take your point. I am not really up on forum ettiquet

The world I come from you shake a persons, hand look him in the eye and say thankyou.

You will notice at the end of my current post I said thanks.



Hayton McGregor

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top