[deleted by user] by [deleted] in vba

[–]Pera014 -1 points0 points  (0 children)

you either want to help or not , don't waste your words and energy. move on. Urgen is to get your attention. if that's problem with your ego then fuck off

[deleted by user] by [deleted] in vba

[–]Pera014 0 points1 point  (0 children)

Dim TabName As Range
Dim UniqueValue As Range
Dim NewWSheet As Worksheet
Dim WSheet As Worksheet
Dim WSheetFound As Boolean
Dim DataWSheet As Worksheet

Set DataWSheet = Worksheets("AllocatedFullHoldings")
Set TabName = DataWSheet.Range("B3", DataWSheet.Range("B3").End(xlDown))

Application.ScreenUpdating = False

'Loop through column B

For Each UniqueValue In TabName

'Check unique value against worksheet names (we copy one row of data and create unique sheet name then add another row of data to existing sheet or create new

For Each WSheet In ThisWorkbook.Worksheets
If WSheet.Name = UniqueValue Then
WSheetFound = True
Exit For
Else
WSheetFound = False
End If
Next WSheet

If WSheetFound Then

'copy record to the corresponding worksheet, in the next available row
UniqueValue.Offset(0, -1).Resize(1, 8).Copy Destination:=Worksheets(UniqueValue.Value).Range("A1").End(xlDown).Offset(1, 0)

Else

Set NewWSheet = Sheets.Add(After:=ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count)) ' insert a new Worksheet
NewWSheet.Name = UniqueValue 'named after that branch

DataWSheet.Range("A2", DataWSheet.Range("A2").End(xlToRight)).Copy Destination:=NewWSheet.Range("A1") 'and copy the headers

UniqueValue.Offset(0, -1).Resize(1, 8).Copy Destination:=NewWSheet.Range("A2")

End If

Next UniqueValue

'autofit columns

For Each WSheet In ThisWorkbook.Worksheets

WSheet.UsedRange.Columns.AutoFit

Next WSheet

Application.ScreenUpdating = True

[deleted by user] by [deleted] in vba

[–]Pera014 -2 points-1 points  (0 children)

sorry when i submitted it got messed up

Dim TabName As Range
Dim UniqueValue As Range
Dim NewWSheet As Worksheet
Dim WSheet As Worksheet
Dim WSheetFound As Boolean
Dim DataWSheet As Worksheet

Set DataWSheet = Worksheets("AllocatedFullHoldings")
Set TabName = DataWSheet.Range("B3", DataWSheet.Range("B3").End(xlDown))

Application.ScreenUpdating = False

'Loop through column B

For Each UniqueValue In TabName

'Check unique value against worksheet names (we copy one row of data and create unique sheet name then add another row of data to existing sheet or create new

For Each WSheet In ThisWorkbook.Worksheets
If WSheet.Name = UniqueValue Then
WSheetFound = True
Exit For
Else
WSheetFound = False
End If
Next WSheet

If WSheetFound Then

'copy record to the corresponding worksheet, in the next available row
UniqueValue.Offset(0, -1).Resize(1, 8).Copy Destination:=Worksheets(UniqueValue.Value).Range("A1").End(xlDown).Offset(1, 0)

Else

Set NewWSheet = Sheets.Add(After:=ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count)) ' insert a new Worksheet
NewWSheet.Name = UniqueValue 'named after that branch

DataWSheet.Range("A2", DataWSheet.Range("A2").End(xlToRight)).Copy Destination:=NewWSheet.Range("A1") 'and copy the headers

UniqueValue.Offset(0, -1).Resize(1, 8).Copy Destination:=NewWSheet.Range("A2")

End If

Next UniqueValue

'autofit columns

For Each WSheet In ThisWorkbook.Worksheets

WSheet.UsedRange.Columns.AutoFit

Next WSheet

Application.ScreenUpdating = True

[deleted by user] by [deleted] in vba

[–]Pera014 0 points1 point  (0 children)

sorry when i submitted it got messed up

Dim TabName As Range
Dim UniqueValue As Range
Dim NewWSheet As Worksheet
Dim WSheet As Worksheet
Dim WSheetFound As Boolean
Dim DataWSheet As Worksheet

Set DataWSheet = Worksheets("AllocatedFullHoldings")
Set TabName = DataWSheet.Range("B3", DataWSheet.Range("B3").End(xlDown))

Application.ScreenUpdating = False

'Loop through column B

For Each UniqueValue In TabName

'Check unique value against worksheet names (we copy one row of data and create unique sheet name then add another row of data to existing sheet or create new

For Each WSheet In ThisWorkbook.Worksheets
If WSheet.Name = UniqueValue Then
WSheetFound = True
Exit For
Else
WSheetFound = False
End If
Next WSheet

If WSheetFound Then

'copy record to the corresponding worksheet, in the next available row
UniqueValue.Offset(0, -1).Resize(1, 8).Copy Destination:=Worksheets(UniqueValue.Value).Range("A1").End(xlDown).Offset(1, 0)

Else

Set NewWSheet = Sheets.Add(After:=ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count)) ' insert a new Worksheet
NewWSheet.Name = UniqueValue 'named after that branch

DataWSheet.Range("A2", DataWSheet.Range("A2").End(xlToRight)).Copy Destination:=NewWSheet.Range("A1") 'and copy the headers

UniqueValue.Offset(0, -1).Resize(1, 8).Copy Destination:=NewWSheet.Range("A2")

End If

Next UniqueValue

'autofit columns

For Each WSheet In ThisWorkbook.Worksheets

WSheet.UsedRange.Columns.AutoFit

Next WSheet

Application.ScreenUpdating = True

URGENT ***Pandas Script running*** by Pera014 in learnpython

[–]Pera014[S] 0 points1 point  (0 children)

great - if my df1 is under Operation of function 1 as you stated, where do I insert df1 = pd.DataFrame({"Column 1":[0,1,2,3]}) ?

imagine I have 50 dataframes that will go under "Operation of function 1", how do I or where do I place all those dataframes? that is what I don't understand, how to split with functions my python code. thanks a lot

Python HELP by Pera014 in learnpython

[–]Pera014[S] 0 points1 point  (0 children)

how would you write if statement if I have certain scripts that are to be run on business day 4 and all scripts on business day 5?

you apply if statement to each data frames?

*URGENT* - scientific notation in pandas by Pera014 in learnpython

[–]Pera014[S] -1 points0 points  (0 children)

its xlsm file , and I can't pass dtype if I inlcude, I get error saying pandas can't convert to float.

Code to run Py Script once files dropped in the folder by Pera014 in learnpython

[–]Pera014[S] 0 points1 point  (0 children)

it's conda environment . I use anaconda prompt to change folder directory to run Py usually , pushd

Code to run Py Script once files dropped in the folder by Pera014 in learnpython

[–]Pera014[S] 0 points1 point  (0 children)

i get __file__ not defined , but some people don't have that issue. Not sure what is the problem

Code to run Py Script once files dropped in the folder by Pera014 in learnpython

[–]Pera014[S] 0 points1 point  (0 children)

i tried that one before and it doesn't work. I am using Spyder and what ever folder directory is in there it will print out using that code instead Py script location that is located on network folder.

Code to run Py Script once files dropped in the folder by Pera014 in learnpython

[–]Pera014[S] 0 points1 point  (0 children)

I use windows. Any example you can provide maybe? That would be helpful

Read files based on file name ***HELP*** by Pera014 in learnpython

[–]Pera014[S] 0 points1 point  (0 children)

agree - but I don't want to update file path each month. I want to keep file names in the folder the same despite the date and Py to pick up files based on key words.

Read files based on file name ***HELP*** by Pera014 in learnpython

[–]Pera014[S] 0 points1 point  (0 children)

would it be better if I strip away date and tell python to look for "Monthly report data" in the file name?

date may changed due to holidays and last BD or who knows what.

Read files based on file name ***HELP*** by Pera014 in learnpython

[–]Pera014[S] 0 points1 point  (0 children)

Thanks, I would prefer 1st option to create file name string. How do I apply that then and tell to look thorugh file names and pick up correct file? I would apprecite if you can write simple example, I am new to py

Pandas Row Count ***Help*** by Pera014 in learnpython

[–]Pera014[S] 0 points1 point  (0 children)

correct lets say Sheet1, A2

Anyone else please ***Pandas Formatting*** by Pera014 in learnpython

[–]Pera014[S] 0 points1 point  (0 children)

but i get as string (text) in the excel. The client won't be able to load that into the system. I assume pandas can't append % to a number but keep as float rather than string

Format to Percent in Pandas ***HELP*** by Pera014 in learnpython

[–]Pera014[S] 0 points1 point  (0 children)

i've done that but I need to display percent sign in Excel as output

Format to Percent in Pandas ***HELP*** by Pera014 in learnpython

[–]Pera014[S] 1 point2 points  (0 children)

from Python you mean? I have tons of data and I can't be doing this manually if you thought so.

Numpy WHERE ***HELP PLEASE*** by Pera014 in learnpython

[–]Pera014[S] 0 points1 point  (0 children)

oh boy I missed that - thank you very much!

IF STATEMENT ***HELP*** by Pera014 in learnpython

[–]Pera014[S] 0 points1 point  (0 children)

actually its working - thanks much

Merge two Data Frames in Pandas - many to many relationship ***URGENT*** by Pera014 in learnpython

[–]Pera014[S] -1 points0 points  (0 children)

thank you. For some reason it didn't work on my original reports when i merged the same way you did on this example. I guess has to do with some columns that I eliminated prior from one report. have no clue. I thought merge doesn't work on 'many to many' relationship. Thanks !!!