Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Goal: get phone numbers in Google trough a table of companies data in Excel
Table: Accounts
Name|Industry|State|City
Hit Combination of Cells and "landline phone" on Google Search and collect in Excel
I'm making this manually. Would love to make it happen trough programing.
Tips and reference coding would help a lot.
Say you have a set of topics on which you wish to do a google search. Place the topics in column A:
The following macro:
Sub dural()
Dim N As Long, i As Long
N = Cells(Rows.Count, "A").End(xlUp).Row
With ActiveWorkbook
For i = 1 To N
.FollowHyperlink Address:="https://www.google.com/search?q=" & Cells(i, 1).Value
Next i
End With
End Sub
will open a set of Google search windows. All you need to do is add to the code to:
select the appropriate link
gather data from the web pages.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I want to save many pdfs but the process of saving via ExportAsFixedFomat takes very long
Do you guys have some idea how to improve my Code (other functions,...)
Code
WordDoc.ExportAsFixedFormat OutputFileName:=wholeString, ExportFormat:=wdExportFormatPDF
Tough to figure out the exact reason in your case. But you can try to deactivate the screen updating like so:
..
Application.ScreenUpdating = False
WordDoc.ExportAsFixedFormat OutputFileName:=wholeString, ExportFormat:=wdExportFormatPDF
Application.ScreenUpdating = True
..
Excel recalculates the workbook before each PDF is generated. Why this should be the case is not immediately obvious. The solution was to insert the following line of code at the beginning of the routine and turn it back to automatic at the end:
Application.Calculation = xlManual
This reduces the total time.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
The point of this is that I have a column of cells in which I'd like to put a comment in each cell (which I move up and down with sort). However I'm a bit too lazy to go through hundreds of cells and each time having to delete the username when I insert a blank comment for future use. So I thought it'd be easier, if I could select a cell and just press a shortcut key instead.
Activecell.AddComment ("test") or Activecell.AddComment ("")
Excel VBA has decent online help
With Worksheets(1).Range("e6").AddComment
.Visible = False
.Text ""
End With
Assign a shortcut key to this macro:
Sub BlankComments()
Dim r As Range
For Each r In Selection
r.ClearComments
r.AddComment Text:=""
Next r
End Sub
Select some cells and run the macro.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have around 500 files of excel and the most part have filter. Now i need to put all information in one sheet. I found how to put all in one sheet but the books with filter only copy information with filter and i need all.
So, i need to remove filter of all excel files. Important (not all files have filter)
Thanks for your help ;)
Before you copy the data, you should use:
If ActiveSheet.FilterMode Then
ActiveSheet.ShowAllData
End If
This will turn off the filter.
Will remove any filter on all opened workbooks, have fun :)
sub try_this()
dim wb as workbook
dim sh as worksheet
for each wb in workbooks
for each sh in wb.worksheets
sh.AutoFilterMode = False
next
next
end sub
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
Does anyone know if it is possible to loop through an Excel spreadsheet using VBA without using ActiveCell?
As an example, how can you create the COUNTIF function from scratch in VBA without using ActiveCell (or calling on the COUNTIF function, obviously)?
I want to avoid ActiveCell because it seems like an unnecessary use of resources to scroll the active cell around when typically you're trying to manipulate a simple matrix, especially when looping through thousands of cells.
Dim c as Range
For Each c in Sheets("Sheet1").Range("A1:A1000").Cells
'do something with c
Next c
What Tim said.
Just to address the count-if portion of your question, here is a way to do it without using the formula:
Sub Macro14()
Dim c As Range
Dim rng As Range
Dim count_if As Integer
Set rng = Sheets("Sheet1").Range("A1:A1000")
For Each c In rng
If c = "Apple" Then
count_if = count_if + 1
End If
Next c
Debug.Print count_if
End Sub
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I would like to learn how to copy cells from an already open excel workbook to another file. I don't just want a code, I want a tutorial. The problem I have is Google is only giving me forums. Can someone suggest a good tutorial with a video? A hyper link would help.
Option Explicit
Sub CopyFromOpenWorkbookToAnother()
'declare variables
Dim wkbCopy as Workbook, wkbPaste as Workbook
Dim wksCopy as Worksheet, wksPaste as Worksheet
Dim rngCopy as Range
'set variables -> change the names to suit your data needs
Set wkbCopy = Workbooks("WorkbookToCopyFrom.xls")
Set wkbPaste = Workbooks("WorkbookToCopyTo.xls")
Set wksCopy = wkbCopy.Sheets("SheetToCopy")
Set wksPaste = wkbPaste.Sheets("SheetToPaste")
Set rngCopy = wksCopy.Range("A1:A10") 'adjust to whatever range you need
rngCopy.Copy wksPaste.Range("A1") 'adjust to wherever you want to paste
End Sub