Need help in Selecting Dynamic cells

tinferns

Board Regular
Joined
Aug 18, 2009
Messages
150
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
Hello Sirs,
Need your help in selecting Cells in using Macros. The below Macro is creating using simple Record Macro option. Help I need is as below:

1) In the below selection I have simply pressed record Macro and done CTRL+A.
2) Right now there is data till column DI. Tomorrow there will be data till column DJ and Tuesday till DK.. and so on.
3) Today this macro will work fine. But after today it will skip data.

What need I do, to make it select all active cells which will dynamically change or increase every day.

Below is the code.

Please help.. Thanks..

==============================================================================================


Sub MrExcel1()
'
' MrExcel1 Macro
'
' Keyboard Shortcut: Ctrl+Shift+Z
'
Range("A1:DI267").Select
Selection.AutoFilter
Range("E1").Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
Sheets.Add After:=ActiveSheet
Range("A2").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
Sheets("time_series_covid19_confirmed_g").Select
Range("DA1").Select
Range(Selection, Selection.End(xlToLeft)).Select
ActiveSheet.Range("$A$1:$DI$267").AutoFilter Field:=2, Criteria1:="India"
Range("E133").Select
Range(Selection, Selection.End(xlToRight)).Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet2").Select
Range("C2").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
Range("E2").Select
Sheets("time_series_covid19_confirmed_g").Select
Range(Selection, Selection.End(xlToLeft)).Select
ActiveSheet.Range("$A$1:$DI$267").AutoFilter Field:=2, Criteria1:="US"
Range("E227").Select
Range(Selection, Selection.End(xlToRight)).Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet2").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Hi Eric.. Thanks for your reply..

Activesheet.UsedRange.Select - This is copying all the data. However, while pasting there seems to be a difference. Is there something I have to do about the pasting bit ?

Please advise.

Thanks

martin
 
Upvote 0
What difference are you seeing? What do you want the paste to do? What code are you currently using?
 
Upvote 0

Forum statistics

Threads
1,214,786
Messages
6,121,546
Members
449,038
Latest member
Guest1337

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top