#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Macro Issue

So I'm trying to record a macro that refreshes data from an Access database,
filters the table to get unique values, then copy/pastes to another sheet to
use those values as column headings (i.e., I'm doing a "Paste
Special"--"Transpose" to make the vertically-listed values paste
horizontally). Only problem is that the macro isn't working completely. The
values refresh goes through and the table updates, but the filtered values
don't copy/paste to the new sheet. If I go through the process manually, it
works, but otherwise I can't get the macro to cooperate.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Macro Issue

Post your code...
--
HTH...

Jim Thomlinson


"thefonz37" wrote:

So I'm trying to record a macro that refreshes data from an Access database,
filters the table to get unique values, then copy/pastes to another sheet to
use those values as column headings (i.e., I'm doing a "Paste
Special"--"Transpose" to make the vertically-listed values paste
horizontally). Only problem is that the macro isn't working completely. The
values refresh goes through and the table updates, but the filtered values
don't copy/paste to the new sheet. If I go through the process manually, it
works, but otherwise I can't get the macro to cooperate.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Macro Issue

Here's the macro code:

Sub macUpdate()
'
' macUpdate Macro
'

'
ActiveWorkbook.RefreshAll
Selection.ClearContents
Sheets("Data").Select
Range("Z4").Select
Range("Table_Query_from_MS_Access_Database_4[[#All],[Station]]"). _
AdvancedFilter Action:=xlFilterInPlace, Unique:=True
Range("Z4:Z14").Select
Selection.Copy
Sheets("Scorecard").Select
Range("B7").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=True
Range("A7").Select
End Sub


"Jim Thomlinson" wrote:

Post your code...
--
HTH...

Jim Thomlinson


"thefonz37" wrote:

So I'm trying to record a macro that refreshes data from an Access database,
filters the table to get unique values, then copy/pastes to another sheet to
use those values as column headings (i.e., I'm doing a "Paste
Special"--"Transpose" to make the vertically-listed values paste
horizontally). Only problem is that the macro isn't working completely. The
values refresh goes through and the table updates, but the filtered values
don't copy/paste to the new sheet. If I go through the process manually, it
works, but otherwise I can't get the macro to cooperate.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Macro Issue

I have no experience with Access but a brief look suggests that it should
work. Try this two liner instead. NO selections. You should use the same
idea to remove selections from the first part


'''''''''
Range("Z4:Z14").Copy
'second line
Sheets("Scorecard").Range("B7"). _
PasteSpecial Paste:=xlPasteValues,Transpose:=True



--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"thefonz37" wrote in message
...
Here's the macro code:

Sub macUpdate()
'
' macUpdate Macro
'

'
ActiveWorkbook.RefreshAll
Selection.ClearContents
Sheets("Data").Select
Range("Z4").Select
Range("Table_Query_from_MS_Access_Database_4[[#All],[Station]]"). _
AdvancedFilter Action:=xlFilterInPlace, Unique:=True
Range("Z4:Z14").Select
Selection.Copy
Sheets("Scorecard").Select
Range("B7").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=True
Range("A7").Select
End Sub


"Jim Thomlinson" wrote:

Post your code...
--
HTH...

Jim Thomlinson


"thefonz37" wrote:

So I'm trying to record a macro that refreshes data from an Access
database,
filters the table to get unique values, then copy/pastes to another
sheet to
use those values as column headings (i.e., I'm doing a "Paste
Special"--"Transpose" to make the vertically-listed values paste
horizontally). Only problem is that the macro isn't working
completely. The
values refresh goes through and the table updates, but the filtered
values
don't copy/paste to the new sheet. If I go through the process
manually, it
works, but otherwise I can't get the macro to cooperate.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Macro Issue

Thanks for the suggestion in cleaning up the query - I'll have to do this.

I think I figured out what the problem was and I still haven't gotten it to
work right.

It appears to be doing the processes out of order - it filters and
copy/pastes the column titles either before or during the refresh, because I
noticed that the data the macro returns is valid...just for the entry prior
to the refresh.

"Don Guillett" wrote:

I have no experience with Access but a brief look suggests that it should
work. Try this two liner instead. NO selections. You should use the same
idea to remove selections from the first part


'''''''''
Range("Z4:Z14").Copy
'second line
Sheets("Scorecard").Range("B7"). _
PasteSpecial Paste:=xlPasteValues,Transpose:=True



--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"thefonz37" wrote in message
...
Here's the macro code:

Sub macUpdate()
'
' macUpdate Macro
'

'
ActiveWorkbook.RefreshAll
Selection.ClearContents
Sheets("Data").Select
Range("Z4").Select
Range("Table_Query_from_MS_Access_Database_4[[#All],[Station]]"). _
AdvancedFilter Action:=xlFilterInPlace, Unique:=True
Range("Z4:Z14").Select
Selection.Copy
Sheets("Scorecard").Select
Range("B7").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=True
Range("A7").Select
End Sub


"Jim Thomlinson" wrote:

Post your code...
--
HTH...

Jim Thomlinson


"thefonz37" wrote:

So I'm trying to record a macro that refreshes data from an Access
database,
filters the table to get unique values, then copy/pastes to another
sheet to
use those values as column headings (i.e., I'm doing a "Paste
Special"--"Transpose" to make the vertically-listed values paste
horizontally). Only problem is that the macro isn't working
completely. The
values refresh goes through and the table updates, but the filtered
values
don't copy/paste to the new sheet. If I go through the process
manually, it
works, but otherwise I can't get the macro to cooperate.





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Macro Issue

Is there a break command or something that will force the macro to wait until
the refresh completes?

"thefonz37" wrote:

Thanks for the suggestion in cleaning up the query - I'll have to do this.

I think I figured out what the problem was and I still haven't gotten it to
work right.

It appears to be doing the processes out of order - it filters and
copy/pastes the column titles either before or during the refresh, because I
noticed that the data the macro returns is valid...just for the entry prior
to the refresh.

"Don Guillett" wrote:

I have no experience with Access but a brief look suggests that it should
work. Try this two liner instead. NO selections. You should use the same
idea to remove selections from the first part


'''''''''
Range("Z4:Z14").Copy
'second line
Sheets("Scorecard").Range("B7"). _
PasteSpecial Paste:=xlPasteValues,Transpose:=True



--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"thefonz37" wrote in message
...
Here's the macro code:

Sub macUpdate()
'
' macUpdate Macro
'

'
ActiveWorkbook.RefreshAll
Selection.ClearContents
Sheets("Data").Select
Range("Z4").Select
Range("Table_Query_from_MS_Access_Database_4[[#All],[Station]]"). _
AdvancedFilter Action:=xlFilterInPlace, Unique:=True
Range("Z4:Z14").Select
Selection.Copy
Sheets("Scorecard").Select
Range("B7").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=True
Range("A7").Select
End Sub


"Jim Thomlinson" wrote:

Post your code...
--
HTH...

Jim Thomlinson


"thefonz37" wrote:

So I'm trying to record a macro that refreshes data from an Access
database,
filters the table to get unique values, then copy/pastes to another
sheet to
use those values as column headings (i.e., I'm doing a "Paste
Special"--"Transpose" to make the vertically-listed values paste
horizontally). Only problem is that the macro isn't working
completely. The
values refresh goes through and the table updates, but the filtered
values
don't copy/paste to the new sheet. If I go through the process
manually, it
works, but otherwise I can't get the macro to cooperate.



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Macro Issue


application.enableevents=false

code
reset to true
rest of code
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"thefonz37" wrote in message
...
Thanks for the suggestion in cleaning up the query - I'll have to do this.

I think I figured out what the problem was and I still haven't gotten it
to
work right.

It appears to be doing the processes out of order - it filters and
copy/pastes the column titles either before or during the refresh, because
I
noticed that the data the macro returns is valid...just for the entry
prior
to the refresh.

"Don Guillett" wrote:

I have no experience with Access but a brief look suggests that it should
work. Try this two liner instead. NO selections. You should use the same
idea to remove selections from the first part


'''''''''
Range("Z4:Z14").Copy
'second line
Sheets("Scorecard").Range("B7"). _
PasteSpecial Paste:=xlPasteValues,Transpose:=True



--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"thefonz37" wrote in message
...
Here's the macro code:

Sub macUpdate()
'
' macUpdate Macro
'

'
ActiveWorkbook.RefreshAll
Selection.ClearContents
Sheets("Data").Select
Range("Z4").Select
Range("Table_Query_from_MS_Access_Database_4[[#All],[Station]]"). _
AdvancedFilter Action:=xlFilterInPlace, Unique:=True
Range("Z4:Z14").Select
Selection.Copy
Sheets("Scorecard").Select
Range("B7").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=True
Range("A7").Select
End Sub


"Jim Thomlinson" wrote:

Post your code...
--
HTH...

Jim Thomlinson


"thefonz37" wrote:

So I'm trying to record a macro that refreshes data from an Access
database,
filters the table to get unique values, then copy/pastes to another
sheet to
use those values as column headings (i.e., I'm doing a "Paste
Special"--"Transpose" to make the vertically-listed values paste
horizontally). Only problem is that the macro isn't working
completely. The
values refresh goes through and the table updates, but the filtered
values
don't copy/paste to the new sheet. If I go through the process
manually, it
works, but otherwise I can't get the macro to cooperate.




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro issue Farhad Excel Discussion (Misc queries) 5 December 21st 08 06:05 PM
Macro name issue JP[_3_] Excel Programming 3 October 31st 07 01:10 AM
Macro issue Dustin Excel Programming 3 May 29th 07 11:52 AM
Macro issue Steved Excel Programming 4 May 24th 06 10:08 AM
Excel Macro Issue Trying to autorun Macro Upon Opening Worksheet wyndman Excel Programming 2 May 25th 04 06:59 PM


All times are GMT +1. The time now is 05:30 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"