Recorded Macro - fill ranges - new tabs - hide formulas? Thank you :)

Rickster7

New Member
Joined
Apr 11, 2015
Messages
13
Hi,

I created a recorded macro. What im doing is downloading a file from a database and have to update that file with the old data from prior download and extract the formats and formulas into the new download. My problem is when i did the recorded macro I copied the formula from the prior tab and had to manually change the tab name and used the auto fill to capture the old data into the new. I know there will be times that the formulas will have to go down further which is 3 columns and it wont be able to capture all the data from the old as there can be longer ranges. Any ideas and is there a way to hide the formulas and be able still be able to apply changes once the macro is ran? Hopefully someone can help. thanks in advance!


*note: The 3 columns may need to be longer ranges is
Marketer,Doctor,Action Taken
Is there a way when i bring the new data i dont have to change tab names into a new tab for the formula. The tab im extracting and copying from is named "OLD". How can i recreate this process?
Again any help will be most appreciated. thanks so much!



Sub Macro3()
'
' Macro3 Macro
'
' Keyboard Shortcut: Ctrl+k
'
ActiveCell.FormulaR1C1 = "Marketer"
Range("J1").Select
ActiveCell.FormulaR1C1 = "Doctor"
Range("K1").Select
ActiveCell.FormulaR1C1 = "Action Taken"
Range("I2").Select
Sheets("NEW").Select
Range("I2:K2").Select
ActiveWindow.SmallScroll Down:=-18
Selection.Copy
Sheets("Unprocessed EOEs").Select
ActiveSheet.Paste
Range("I2").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = _
"=IF(ISERROR(VLOOKUP(RC3,OLD!R2C3:R250C11,7,FALSE)=TRUE),"" "",VLOOKUP(RC3,OLD!R2C3:R250C11,7,FALSE))"
Range("J2").Select
ActiveCell.FormulaR1C1 = _
"=IF(ISERROR(VLOOKUP(RC3,OLD!R2C3:R250C11,8,FALSE)=TRUE),"" "",VLOOKUP(RC3,OLD!R2C3:R250C11,8,FALSE))"
Range("K2").Select
ActiveCell.FormulaR1C1 = _
"=IF(ISERROR(VLOOKUP(RC3,OLD!R2C3:R250C11,9,FALSE)=TRUE),"" "",VLOOKUP(RC3,OLD!R2C3:R250C11,9,FALSE))"
Range("I2").Select
Selection.AutoFill Destination:=Range("I2:I46")
Range("I2:I46").Select
ActiveWindow.SmallScroll Down:=-3
Range("J2").Select
Selection.AutoFill Destination:=Range("J2:J46")
Range("J2:J46").Select
Range("K2").Select
Selection.AutoFill Destination:=Range("K2:K46")
Range("K2:K46").Select
Range("K7").Select
ActiveWindow.SmallScroll Down:=15
Range("I45").Select
ActiveWindow.SmallScroll Down:=-33
Columns("A:Q").Select
Columns("A:Q").EntireColumn.AutoFit
Rows("1:1").Select
Selection.Font.Bold = True
Selection.Font.Underline = xlUnderlineStyleSingle
Rows("1:1").Select
Range(Selection, Selection.End(xlDown)).Select
ActiveWorkbook.Worksheets("Unprocessed EOEs").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Unprocessed EOEs").Sort.SortFields.Add Key:=Range( _
"J2:J46"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("Unprocessed EOEs").Sort
.SetRange Range("A1:K46")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("A1").Select
End Sub
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Forum statistics

Threads
1,223,270
Messages
6,171,103
Members
452,379
Latest member
IainTru

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