Help: Pulling data from all worksheets

Clayton Michael

New Member
Joined
Dec 7, 2011
Messages
6
Hey all,
Hopefully this is an easy fix. I'm trying to pull a contact from every worksheet in a workbook. All the worksheets are formatted the same way. The only snag I'm running into is getting the macro to select from the correct worksheet specifically the following line:

"WkSht.Range("A8").End(xlDown).Select"

Here's the entire script I'm working with right now:
--------------------------------

Sub Pull_Contacts()
Dim WkSht As Worksheet

For Each WkSht In ThisWorkbook.Worksheets
If WkSht.Name <> "Upcoming" Then
WkSht.Range("A8").End(xlDown).Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Upcoming").Select
Range("A3").End(xlDown).Offset(1, 3).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End If
Next WkSht
End Sub

-------------------------------------

If anyone can tell me what I'm doing wrong or possibly make suggestions I'd really appreciate it.
 

Clayton Michael

New Member
Joined
Dec 7, 2011
Messages
6
I was actually able to figure it out. The "problem line" needed to be preempted with:

Sheets(WkSht.Name).Select
 

Forum statistics

Threads
1,081,523
Messages
5,359,263
Members
400,523
Latest member
ExcelNewbie98

Some videos you may like

This Week's Hot Topics

  • VBA (Userform)
    Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
  • List box that changes fill color
    Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
  • Remove duplicates and retain one. Cross-linked cases
    Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
  • VBA Copy and Paste With Duplicates
    Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
  • Macro
    is it possible for a macro to run if the active cell value is different to the value above it
  • IF DATE and TIME
    I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...
Top