PDA

View Full Version : Vba to copy range from Sheet to another and define a name



PERSL
10-08-2023, 03:47 AM
Good day all

I need a vba code to do the following comands:

1 - copy range ("GT300") and ("GV300", Selection.End(xlToRight)) from ("Sheet1")
2 - H lookup ("Sheet1") ("GT291") on ("Sheet2").Range("B:B")
3 - Add the copied ranges from ("Sheet1") as new entery on ("Sheet2") based on the H lookup result
4 - Create new defined name from ("Sheet2") last entery from column D to last value on same row , Selection.CreateNames Top:=False, Left:=True, Bottom:=False, Right:=False
31097

Aussiebear
10-08-2023, 06:12 AM
Welcome to VBAX PERSL. This sounds very much like a homework question.....

PERSL
10-08-2023, 07:50 AM
Welcome to VBAX PERSL. This sounds very much like a homework question.....


I need the code badly for my self

jdelano
10-09-2023, 01:33 AM
Here are a few links that should help you achieve what you want.
How to Copy and Paste in Excel Using VBA (12 Methods) - ExcelDemy (https://www.exceldemy.com/copy-and-paste-in-excel-vba/)
How to Use HLOOKUP in VBA (With Examples) - Statology (https://www.statology.org/vba-hlookup/)
Excel VBA Create Named Range: Step-by-Step Guide and 4 Examples (powerspreadsheets.com) (https://powerspreadsheets.com/vba-create-named-range/)

p45cal
10-09-2023, 04:55 AM
Here's another link which should help you achieve what you want; your cross post at Eileen's Lounge: http://www.eileenslounge.com/viewtopic.php?f=27&t=40213