[mso] Excel VBA Code

  • From: "Herbert Chitate" <herbertc@xxxxxxxxx>
  • To: <mso@xxxxxxxxxxxxx>
  • Date: Mon, 21 Jan 2008 08:52:21 -0000

Hi Chauhan,

Many thanks for the below; I guess my next question would be, how do I
make this into a macro? I have tried recording a new macro and copying
the code into the visual basic editor, but I am guessing it needs some
sort of a slight tweak when copied into the editor.

Can anyone help please.

Many thanks

Herbert

-----Original Message-----
From: mso-bounce@xxxxxxxxxxxxx [mailto:mso-bounce@xxxxxxxxxxxxx] On
Behalf Of Chauhan Dharmesh
Sent: 18 January 2008 11:14
To: mso@xxxxxxxxxxxxx
Subject: [mso] Re: Excel VBA Code

Write VBA code in sheet2
  =20
  Private Sub Worksheet_Change(ByVal Target As Range)
 =20
  If Target.Column =3D 4 Then
    Dim iChar As Integer
    iChar =3D 66
    For i =3D 6 To 15
        If LCase(Sheet2.Range("D" & i).Text) <> "non specified" Then
            Sheet1.Range(CStr(Chr(iChar)) & "2") =3D Sheet2.Range("D" &
i).Text
        Else
            Sheet1.Range(CStr(Chr(iChar)) & "2") =3D ""
        End If
       =20
        iChar =3D iChar + 1
    Next i
   =20
  End If
End Sub
 =20
Herbert Chitate <herbertc@xxxxxxxxx> wrote:
  Hi All,

I feel I am about to conquer Everest here, but for all you vba gurus,
let's not laugh now. I am teaching myself vba, and applying it to some
stuff I am working on, and was wondering if some kind soul out there
could help me with a code to carry out a certain function, as part of a
bigger code. It needs to perform the following task:

1)On sheet 2 (which will be the active sheet); look at cell D6 and if it
says "Non Specified", ignore this cell and move on to cell D7. If there
is any other value in this cell, copy that value to cell B2 on sheet 1

2) Look at cell D7 (sheet 2) and if it says "Non Specified", ignore this
cell and move on to cell D8. If there is any other value in this cell,
copy that value to cell c2 on sheet 1.

The idea is to repeat the above from d6 to d15 on sheet 2 (vertical),
and copying the contents (if something has been specified)from b2 to j2
on to sheet 1(horizontal.

I am looking for a vba code solution and not a formula, as I would b2 to
j2 on sheet one not to contain formulas (there is a method in the
madness, trust me).

I hope I have explained myself ok, but if not, please give me a shout
guys.....


Many thanks

Herbert
*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx
or MicrosoftOffice@xxxxxxxxxxxxxxxx

To send mail to the group, simply address it to mso@xxxxxxxxxxxxx

To Unsubscribe from this group, visit the group's homepage and use the
dropdown menu at the top. This will allow you to unsubscribe your email
address or change your email settings to digest or vacation (no mail).
//www.freelists.org/webpage/mso

To be able to share files with the group, you must join our Yahoo sister
group. This group will not allow for posting of emails, but will allow
you to join and share problem files, templates, etc.:
http://tech.groups.yahoo.com/group/MicrosoftOffice . This group is for
FILE SHARING ONLY.

If you are using Outlook and you see a lot of unnecessary code in your
email messages, read these instructions that explain why and how to fix
it:
http://personal-computer-tutor.com/abc3/v28/greg28.htm
*************************************************************


      =20
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try
it now.

*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx
or MicrosoftOffice@xxxxxxxxxxxxxxxx

To send mail to the group, simply address it to mso@xxxxxxxxxxxxx

To Unsubscribe from this group, visit the group's homepage and use the
dropdown menu at the top.  This will allow you to unsubscribe your email
address or change your email settings to digest or vacation (no mail).
//www.freelists.org/webpage/mso

To be able to share files with the group, you must join our Yahoo sister
group.  This group will not allow for posting of emails, but will allow
you to join and share problem files, templates, etc.:
http://tech.groups.yahoo.com/group/MicrosoftOffice . This group is for
FILE SHARING ONLY.

If you are using Outlook and you see a lot of unnecessary code in your
email messages, read these instructions that explain why and how to fix
it:
http://personal-computer-tutor.com/abc3/v28/greg28.htm
*************************************************************
*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx or 
MicrosoftOffice@xxxxxxxxxxxxxxxx

To send mail to the group, simply address it to mso@xxxxxxxxxxxxx

To Unsubscribe from this group, visit the group's homepage and use the dropdown 
menu at the top.  This will allow you to unsubscribe your email address or 
change your email settings to digest or vacation (no mail).
//www.freelists.org/webpage/mso

To be able to share files with the group, you must join our Yahoo sister group. 
 This group will not allow for posting of emails, but will allow you to join 
and share problem files, templates, etc.:  
http://tech.groups.yahoo.com/group/MicrosoftOffice . This group is for FILE 
SHARING ONLY.

If you are using Outlook and you see a lot of unnecessary code in your email 
messages, read these instructions that explain why and how to fix it:
http://personal-computer-tutor.com/abc3/v28/greg28.htm
*************************************************************

Other related posts: