24. marts 2011 - 15:45
Der er
1 kommentar og 1 løsning
placere en kommandoknap i højre hjørne af celle
Hvorfor kan jeg ikke skrive .Left = Cells(Rrow + 2, Rcol).Left i denne kode? Sub PlaceButtons() Rrow = ThisWorkbook.Worksheets("UgePlan").Range("O65000").End(xlUp).Row Rcol = ThisWorkbook.Worksheets("UgePlan").Range("O65000").End(xlUp).Column Worksheets("UgePlan").Activate ActiveSheet.Shapes(1).Select With Selection .Top = Cells(Rrow + 2, Rcol).Top .Left = Cells(Rrow + 2, Rcol).Left End With ActiveSheet.Shapes(2).Select With Selection .Top = Cells(Rrow + 2, Rcol + 5).Top .Left = Cells(Rrow + 2, Rcol + 5).Left End With End Sub
Annonceindlæg fra SuperOffice
28. marts 2011 - 15:01
#2
lidt en klamphugger-løsning sikkert, men løste den selv således: Sub MoveShapes() Arow = ThisWorkbook.Worksheets("UgePlan").Range("A65000").End(xlUp).Row Worksheets("UgePlan").Activate ActiveSheet.Shapes(1).Select With Selection .Top = Cells(Arow + 2, 1).Top .Left = Cells(Arow + 2, 1).Left End With ColWidth = Range(Cells(1, 1), Cells(1, 16)).Width ShapeWidth = ActiveSheet.Shapes(1).Width RightCorner = ColWidth - ShapeWidth ActiveSheet.Shapes(1).Select Selection.ShapeRange.IncrementLeft RightCorner ActiveSheet.Shapes(2).Select With Selection .Top = Cells(Arow + 2, 18).Top .Left = Cells(Arow + 2, 18).Left End With Range("B1").Select End Sub