Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Change a specific code to generic in VB macro
I have the following:
Selection.AutoFill Destination:=Range("BE2:BE567"), Type:=xlFillDefault Range("BE2:BE567").Select I would like to change the code to include all possible used cells to fill. How do I do this? -- Sue |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Change a specific code to generic in VB macro
Hi Sue:
Here's one approach. Use a line of code like this to find the last used row: LastRow = Range("B65536").End(xlUp).row OR LastRow = ActiveCell.SpecialCells(xlLastCell).row Then modify your code to this: Selection.AutoFill Destination:=Range("BE2:BE" & Lastrow), Type:=xlFillDefault Range("BE2:BE" & Lastrow).Select Give that a whirl. cheers, gt "Sue" wrote: I have the following: Selection.AutoFill Destination:=Range("BE2:BE567"), Type:=xlFillDefault Range("BE2:BE567").Select I would like to change the code to include all possible used cells to fill. How do I do this? -- Sue |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Change a specific code to generic in VB macro
ooops - one slight change :
LastRow = Range("BE65536").End(xlUp).row OR LastRow = ActiveCell.SpecialCells(xlLastCell).row Then modify your code to this: Selection.AutoFill Destination:=Range("BE2:BE" & Lastrow), Type:=xlFillDefault Range("BE2:BE" & Lastrow).Select "gt" wrote: Hi Sue: Here's one approach. Use a line of code like this to find the last used row: LastRow = Range("B65536").End(xlUp).row OR LastRow = ActiveCell.SpecialCells(xlLastCell).row Then modify your code to this: Selection.AutoFill Destination:=Range("BE2:BE" & Lastrow), Type:=xlFillDefault Range("BE2:BE" & Lastrow).Select Give that a whirl. cheers, gt "Sue" wrote: I have the following: Selection.AutoFill Destination:=Range("BE2:BE567"), Type:=xlFillDefault Range("BE2:BE567").Select I would like to change the code to include all possible used cells to fill. How do I do this? -- Sue |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
code to reassign a macro to a toolbar button because of path change | Excel Discussion (Misc queries) | |||
Generic reference in a Macro | Excel Discussion (Misc queries) | |||
Use a code to populate a cell with a specific value | Excel Worksheet Functions | |||
how do i change or make this macro??? pictures and code included | Charts and Charting in Excel | |||
Creation of a Generic Macro | Excel Worksheet Functions |