LD16
LD16

Reputation: 95

Macro VBA formatting

Hello I have the following MACRO...

Sub RunThis()
With Application
     .Calculation = xlCalculationManual
     .ScreenUpdating = False

 ThisWorkbook.Sheets("Conditions").Range("A27:H54").Copy

 With ThisWorkbook.Sheets("Project")
      .Range("A1").PasteSpecial xlPasteValues
      .Range("A1").PasteSpecial xlPasteFormats
 End With

 ThisWorkbook.Sheets("Conditions").Range("A56:H88").Copy

 With ThisWorkbook.Sheets("Project")
      .Range("A29").PasteSpecial xlPasteValues
      .Range("A29").PasteSpecial xlPasteFormats
 End With
 Call DeleteCellsWithNo
 End With
**With ThisWorkbook.Sheets("Project")
    .Cells("A, 1").Select
End With**
End Sub

What I'm trying to do is Make is select the Cell A1 - also, I'm trying to format the width of cell A1 to autowidth....Any idea?

EDIT: the two stars next to WITH is what i'm trying to do but it gives me an error

EDIT2:

    With ThisWorkbook.Sheets("Project")
        .Cells(1, "A").Select
        .Cells(1, "A").Width = 50
    End With

I have this but gives me errors on the WIDTH part. I guess I want to set the width because the values are of different length so 50 will work for all

Upvotes: 1

Views: 58

Answers (1)

Ahmadali Afkhami
Ahmadali Afkhami

Reputation: 11

I might misunderstand your point, but if you want to autowidth your cell (your column) this works:

ThisWorkbook.Sheets("Project").Columns("A:A").AutoFit

Upvotes: 1

Related Questions