Close Window   
Free Ebook
Got an Excel Question?
Ask it in our Excel forum!
TeachExcel.com
Subscribe for Free Excel tips & more!
E-mail:
Advertisements



Select Sheets Using Vba Whose Name Contain Specific Word (word From Variable)

Forum Register
Search Excel Forum Posts, Tutorials, Macros, Tips, and More

Select sheets using VBA that contain specific word (word from variable).

I want to select all sheets in active workbook whose name contains a specific word. I getting such specific word from variable.

Thanks
Amir
View Answers     

Similar Excel Tutorials

Excel Prank - Automatically Change User-Entered Text
Use AutoCorrect to change the text a user enters into something funny. This is a great little prank to use on co-wo ...
Determine if Cells Contain a Specific Value in Excel
Find if a cell or range of cells contains a specific value in Excel. This method can be used on individual cells wh ...
Simple Excel Function to Extract a Word or Text from a Cell
Excel function that makes it easy to extract a word or text from a cell in Excel. This is a single function! It doe ...
Delete All Rows that Contain a Specific Value in Excel
Quickly find all rows in Excel that contain a certain value and then delete those rows. This is a simple technique ...

Helpful Excel Macros

Open Microsoft Word from Excel
- This free macro will open the Microsoft Word program on your computer. You do need to have this program first. This wi
Open a Word Document from Excel
- This Microsoft Excel macro will open a Microsoft Word document from excel. With this macro, you can open any word docume
Extract a Word from a Sentence / Cell in Excel with this UDF - Allows for a User-Defined Delimiter
- Extract whole words from a cell or sentence in Excel with this UDF. This allows you to specify which word from a cell y
Extract the First Word from a Cell in Excel - User Defined Delimiter Text Extraction - UDF
- This free Excel UDF (user defined function) returns the first word from a cell in Excel. This extracts the first word f
Capitalize the First Letter of Every Word in a Cell
- This macro will make the text of any selected cell in excel proper case. This means that the first letter of any word in

Similar Topics







Hi,

I have a macro and at one part of it I need it to do the following:

Input

Column C

word word word
word word
word word word word
word word
...

Output

Column F

word-word-word
word-word
word-word-word-word
word-word
...

As you see, I want to replace the spaces, " ", with "-". Thanks in advance.


Hello out there -
Here i am asking for more asistance, again.

I would like to copy the words in one column repeat them 8 times each and add a number to the end of each word that increments. The revised list can stay in the same column, just need to be able to do how ever many words are in the original column.
Thanks in advance--

EXAMPLE:

Any Word Any Word 100 New Word Any Word 200 Next word Any Word 300 Any Word 400 Any Word 500 Any Word 600 Any Word 700 Any Word 800 New Word 100 New Word 200 New Word 300 New Word 400 New Word 500 New Word 600 New Word 700 New Word 800 Next Word 100 Next Word 200 Next Word 300 Next Word 400 Next Word 500 Next Word 600 Next Word 700 Next Word 800


I know the title is confusing, but I don't kow how to describe this otherwise.

Here is the challenge I'm facing:

I have a list of synonyms in word in the following format:

A B C D
word A1 Word A2 Word A3 (<-- all A-words are synonyms from each other on the same row)
Word B1 Word B2 Word B3 Word B4 (<-- all B-words are synonyms from each other on the same row)



Now I need the following output:
Word A1 Word A2
Word A1 Word A3
Word A2 Word A1
Word A2 Word A3
Word A3 Word A1
Word A3 Word A2
Word B1 Word B2
Word B1 Word B3
Word B1 Word B4
Word B2 Word B1
Word B2 Word B3
Word B2 Word B4
Word B3 Word B1
Word B3 Word B2
Word B3 Word B4
Word B4 Word B1
Word B4 Word B2
Word B4 Word B3


If I try to explain it in words: I need all combinations of synonyms in pairs formatted in rows.

I need this for a piece of software which allows import of synonyms, but the format has to be as above (each synonym on a row, in pairs).

How would I accomplish this in Excel?

I've uploaded an excel file with an example and on the second worksheet the complete synonym list (in foreign language, but that shouldn't matter)

You can find it he
http://rapidshare.com/files/269768819/synonyms.xls.html

I would appreciate it very much if someone can offer me a solution.

Kind regards,
Erik


Hi,

I have a spreadsheet that I have variable data in and I want to transfer specific parts of the workbook into a Word doc.

Not a problem with the Excel part, I can select each and every cell that I want, copy them and then... yeah.

Recording a macro hasn't done the trick as the code I have only copies and doesn't paste. I know I can edit the code to open Word but the problem is that when in Word, the data needs to go to very specific places, some of it goes in the header, most goes in the main body, I can't see how this could be done as there are no cell refs as in Excel!

So my question is that is it possible to paste to say halfway in a sentence, in a macro?


I use excel '08 for Mac, and would like to hyperlink a word/phrase to a specific word or pdf document on my computer.

Here's what I do: right-click the word/phrase in the cell, click "hyperlink," and select "document" then click "ok"

Here's what happens: although the word then appears hyperlinked, when I click on it I get the message "cannot open that specific file".

Any suggestions? Thanks in advance, Nate


Hello guys and gals,

I'm stuck with trying to extract a specific word from a cell that contains a long string with
variable length. To add to the misery, the position of the word within the line is also not fixed. Come one, excel vba/function geniuses! help out plz.

As an example, suppose the cell contains a sentence,"What is your name" and i want to extract the word "name" into a cell. But this is a long list and the position of the word name is different in some cells.

So, I need a function that extracts using left, mid, or right function, based on finding the word "name".
Also the positive point is that the word that i need to extract is exactly the same so it is of fixed length.

I hope the problem has been adequately explained.


Thanks and warm regards,

Offeror


Using the code in this post http://www.mrexcel.com/forum/showthr...l+word, I can automate exporting to word with a range of cells. How do I alter the macro to export to a specific word file? The word file has set margins. How do I make the exported image fit the margins in the word document automatically?

Thanks


I am trying to test for a specific word in a specific cell to determine the formatting of the data that follows. Any thoughts on how to proceed?

For example, I am trying to determine if cell A60 has the word Trend or the word Resistance


I have been having trouble locating a specific word. It is not that I can't find it, but it contains a word within a word.

Let me explain.

I'm using the
Set r = Cells.Find("LOAN")

However, There may (or may not) be the word(s) "LOANID" or "SLOAN" located in the columns before finding "LOAN"

How can I have the macro specifically find what I'm looking for?

Thanks in advance,

-Robert


I use excel to launch other applications like PowerPoint and Word. I can specifically go to a PowerPoint Page when I open it from Excel. How do I go to a specific page of a word document that I have just opened from Excel?

Here is some code that I currently use (That works great).
setup: Shx is a sheet or slide number, Tx is used as an idicator of file type.

This opens a PowerPoint file and goes to a specific slide.
If Tx = "File.ppt" Then
If IsNumeric(Shx.Value) Then
Set PPT = GetObject(Px & Fx)
PPT.Application.Visible = True
PPT.Application.Activate
If Shx > 0 Then Set Slide = PPT.Slides(Shx.Value)
Slide.Select
Exit Sub
End If
End If

Here is what I have for the Word document. This one will not goto a specific page like the one above. (This does not work).

If Tx = "File.doc" Then
Tx.Select
Set Word = GetObject(Px & Fx)
Word.Application.Visible = True
Word.Application.Activate
If Shx > 0 Then Word.Goto Shx.Value
Exit Sub
End if


Hello, I am having a problem looping through a range.

I have a range name called summary_object_codes

And what i want to do is loop through each cell in that range.

my code so far is

The problem is i cant seem to select the cell C

i tried c.select but didn't work - I am sure there is a way - but i can't seem to do it


Sub summary_totals()

Dim c
Dim word, codenumber, PLname, newrownumber, totalentered

For Each c In Application.Range("summary_object_codes")
Sheets("Assisting Sheet").Select
Range("summary_object_codes").Select

word = c 'this just assigns the value in c to the variable word
codenumber = c.Address.Offset(0, 1).Value ' i am trying to assign the value in the cell next to c to the variable codenumber


etc...



Thanks a lot
Jonty


I require code to find a specific word in a column/sheet to add into my macro.

My current macro:-

Code:

Sub copypaste2()
ActiveCell = ("*Default*")
Rows("2:2").Select
Selection.Copy
	'Find the word *Default* in worksheet and make cell active
Selection.Insert Shift:=xlToRight
	'Find the word *Default* in worksheet and make cell active
Selection.ClearContents
End Sub


At the moment the macro will enter the word "*Default*" into the current active cell, then copy the entire contents of Row 2.
The next missing code will need to find the word "*Default*" in the sheet and insert the copied cells.
Then the next missing code again will need to find the word "*Default*" in the sheet and delete the contents of the cell so that when the macro is re-run the word *Default* is only found once.

Hopefully when the code is searching for the specific word the copy function is not cancelled.

Any help is appreciated, thank you.


I require code to find a specific word in a column/sheet to add into my macro.

My current macro:-

Code:

Sub copypaste2()
ActiveCell = ("*Default*")
Rows("2:2").Select
Selection.Copy
	'Find the word *Default* in worksheet and make cell active
Selection.Insert Shift:=xlToRight
	'Find the word *Default* in worksheet and make cell active
Selection.ClearContents
End Sub


At the moment the macro will enter the word "*Default*" into the current active cell, then copy the entire contents of Row 2.
The next missing code will need to find the word "*Default*" in the sheet and insert the copied cells.
Then the next missing code again will need to find the word "*Default*" in the sheet and delete the contents of the cell so that when the macro is re-run the word *Default* is only found once.

Hopefully when the code is searching for the specific word the copy function is not cancelled.

Any help is appreciated, thank you.


I am not that proficient in Excel, but I would like to know if there is a way to perform a function or program/macro that will allow me to create a robust list of text variables quickly.

For example:

In column A, I have "word 1, word 2, word 3, word 4, word 5" in cells A1-A5 respectively.

In Column B, I have "word a, word b, word c, word d, word e" in cells B1-B5 respectively.

I need the final list to combine "word 1" with "word a, word b, word c, word d, word e" for the final output of "word 1 word a, word 1 word b, word 1 word c, word 1 word d, word 1 word e" and so on down the list until all possible combinations of words are accounted for and present.

This is in an effort to quickly and efficiently create keyword combinations for an online PPC program that has over 470 campaigns, 2800 ad groups. So, manual creation of keyword variations is just not efficient or an option.

PLEASE HELP!!


hi,
i have different text in each cell and i need to extract a specific word, from each cell, if it is there - if not, then extract nothing, or "FALSE" or whatever.

So for example one cell ie. (A2) might contain: Nothing splendid has ever been achieved except by those who dared.

And another cell ie. (A3) might containt: The most splendid people are those who dare.

In column B I want to extract the word (splendid) from the two sentences. with extract i don't mean cut but a copy of the word - to tell me these two cells include this word.

please help me.
thank you in advance.




I have the following code that takes information from excel and creates a word file and saves it automatically to a specific location.

I need it to keep the same file name from the specific cells listed but instead of auto saving to a location I want it to prompt me with a save as dialog box so that I can select the location to save the word document to without changing the excel workbook location

Code:

Sub Save()
Dim varDoc As Object

        Set varDoc = CreateObject("Word.Application")

                  varDoc.Visible = True
                  Sheets("Steps").Range("A1:J56").Copy
                  varDoc.Documents.Add
                  varDoc.Selection.Paste
                  
                  ThisFile = Sheets("Variables").Range("A91")
                  varDoc.activedocument.SaveAs Filename:="C:\Documents and Settings\Desktop\Testing Word\TEST\" & ThisFile
                  varDoc.Quit
         Application.CutCopyMode = False
End Sub


Any Help Would be appreciated

thanks,

Matt


Hey Guys,

I've been reading other posts/Google Searching, but I just can't figure out the code.

Im trying to :
(this is not in VBA code)

If Cells I6/J6 (MergedCell)= "A Word*" (text with a wildcard)

Then Copy I4:J6 text values to Sheet 2
But put those cells in one row/seperate columns in the order of:
I4 | J4 | I5 | J5 | I6/J6 (MergedCell) | using a new row everytime a new entry is required.

e.g. If I change I6/J6 from "Goat" to "A Word" to "Bear" to "A Word 2", then this would record the 2 "A Word" entries in Sheet2 on different rows.

and repeat this process for K6/L6, M6/N6 etc.

I want to basically track the Sheet1 changes in Sheet2, when a merged cell text value = a specific word.

Many Thanks


Hi!

I would like to request your help creating a macro to grab specific data from an Excel document and paste it into a Word document.

This is my dilemma:

I have a long Excel document with two columns, one for the terms in English and one for the translation into Spanish.

I have a Word document for each letter of the alphabet. For instance, one document is A.doc, another is B.doc, etc. Each Word document already contains a populated table with two columns.

I want the macro to look in each row of the Excel document to find a word starting with an "A" in the first column and paste the content of the entire row into the Word document named "A.doc", at the end of the table, without deleting other rows in the existing Word table.

After that, I would like to do the same thing with letter "B", "C", etc.

Any suggestions would be greatly appreciated.

Thanks so much.

Sandra

I have a Word doc that I would like to load into Excel (or Access, if needs be) word by word. So if the Word doc has 500 words spread over 50 lines and two pages, I would like the 500 words to appear in cells A1 through A500, one word per cell.

Any ideas? I'm not quite sure how to do it, but perhaps if I could feed each word in Microsoft Word into an Array, then I could have the Array be output in Excel.

Any suggestions would be appreciated. Thank you.

Jared


Hi...

I am trying to modify a code I got that will allow me to add a progress indicator to my macro. My problem is that I need to count the number of occurrences of a specific word in a text file for the macro to be able to guage the progress. The specific word is six characters in length and is: "TY - " (so TY + plus 2 spaces + dash + 1 space). It recurrs every time there is a new string of information that excel will use.

Thanks.

AMAS


I've inserted a Word document as an OBJECT in my spreadsheet and am trying to do the equivalent of a SELECT ALL, COPY so I can paste the data to the spreadsheet directly.
The problem is, as soon as the Word Object is Selected (i.e Double Clicked), WORD becomes the Active Application (even within Excel)

Presently, I have the user EDIT/SELECT ALL and then EDIT/COPY and then click a command button in Excel to do the rest. (BTW, a WORD macro cannot be attached to the WORD document being loaded.)

Any ideas on how to do this via MACRO in Excel? (When the Word document is selected, the top menu reverts to WORD's menu - and SELECTION.WHOLESTORY (Select All via Word's menu) is not supported (?) in Excel.

Any suggestions on a work around would be much appreciated!

Thanks!!


I have a workbook that is a business plan financial template. In word, I
have created the instruction for the template.

Is there a way to combine the two work products so that the word document
came into the workbook as a separate tab?

Is there a way to link the two documents together so that say double
clicking on a cell would open that word document to a specific area of the
instructions?

Thanks for your help.



My macro has worked fine previously and all of a sudden this error message comes up:

Object Variable or WIth block variable not set

This happens on the last line of this:

Sheets("Menu").Select
Future = Cells(34, 2).Value
If Future = Empty Then GoTo 1
Sheets("Portfolio Valuation").Select
Cells.Find(What:=Future).Select

Basically I am asking the marco to seach for the word Liab, which I have entered a on a sheet, and it calls this Future as above. Then it seaches for this word on the sheet Portfolio Valuation.

Please help!!!


Good Afternoon all!

I have a word document that uses a specific spreadsheet to run a merge that creates a word version of a report from excel.

Is there a way that I can use VBA to create open an existing word document? The macro is already designed to run on opening this file.

Regards

Jorn


Hi,
I have a word document and an excel spreadsheet. I'm trying to take information from excel and put it in specific location in the word document. I've been trying to do this with ranges and bookmarks, something along the line of the following. I obviously have no idea what I'm doing... and would appreciate any help! I'm also not sure I've set the bookmark field in the Word Doc properly, all I did was go to insert>bookmark and name it.

Sub Macro3()

Dim wdApp As Word.Application
Dim wdDoc As Word.Document
Dim BMRange As Word.Range
Dim amount As Range
Dim investor As Range

Set wdApp = CreateObject("Word.Application")
Set wdDoc = wdApp.Documents.Open("C:\Documents and Settings\KFaith\My Documents\Subscriptions.doc")
appWD.Visible = True

Set amount = ThisWorkbook.Sheets("2008").Range("M12")
Set investor = ThisWorkbook.Sheets("2008").ActiveCell.Offset (0,1).Select

Set BMRange = wdDoc.Goto(what:=wdGoToBookmark, Name:="amount")
BMRange.Text = amount

Set BMRange = wdDoc.Goto(what:=wdGoToBookmark, Name:="investor")
BMRange.Text = investor